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;
|
||||||
@@ -494,6 +494,7 @@ func (s *OrganizationService) CreateOrganization(
|
|||||||
TenantID: organization.TenantID,
|
TenantID: organization.TenantID,
|
||||||
Active: false,
|
Active: false,
|
||||||
Slug: slug.Make(organization.Name),
|
Slug: slug.Make(organization.Name),
|
||||||
|
SearchEngineIndexing: coredata.SearchEngineIndexingNotIndexable,
|
||||||
MailingListID: &mailingList.ID,
|
MailingListID: &mailingList.ID,
|
||||||
CreatedAt: now,
|
CreatedAt: now,
|
||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
|
|||||||
Reference in New Issue
Block a user