Fix empty search_engine_indexing on trust centers
Trust centers were created without setting SearchEngineIndexing, defaulting to an empty string in the database. This caused scan errors when loading trust centers. Add a migration to fix corrupted rows, set a DEFAULT on the column, and add a CHECK constraint. Also set the field explicitly when creating new trust centers. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
9
pkg/coredata/migrations/20260325T120000Z.sql
Normal file
9
pkg/coredata/migrations/20260325T120000Z.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
CREATE TYPE search_engine_indexing AS ENUM ('INDEXABLE', 'NOT_INDEXABLE');
|
||||
|
||||
UPDATE trust_centers
|
||||
SET search_engine_indexing = 'NOT_INDEXABLE'
|
||||
WHERE search_engine_indexing = '';
|
||||
|
||||
ALTER TABLE trust_centers
|
||||
ALTER COLUMN search_engine_indexing TYPE search_engine_indexing
|
||||
USING search_engine_indexing::search_engine_indexing;
|
||||
@@ -489,14 +489,15 @@ func (s *OrganizationService) CreateOrganization(
|
||||
}
|
||||
|
||||
trustCenter = &coredata.TrustCenter{
|
||||
ID: gid.New(tenantID, coredata.TrustCenterEntityType),
|
||||
OrganizationID: organization.ID,
|
||||
TenantID: organization.TenantID,
|
||||
Active: false,
|
||||
Slug: slug.Make(organization.Name),
|
||||
MailingListID: &mailingList.ID,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
ID: gid.New(tenantID, coredata.TrustCenterEntityType),
|
||||
OrganizationID: organization.ID,
|
||||
TenantID: organization.TenantID,
|
||||
Active: false,
|
||||
Slug: slug.Make(organization.Name),
|
||||
SearchEngineIndexing: coredata.SearchEngineIndexingNotIndexable,
|
||||
MailingListID: &mailingList.ID,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}
|
||||
|
||||
logoFile *coredata.File
|
||||
|
||||
Reference in New Issue
Block a user