Files
probo/pkg/coredata/migrations/20260710T144904Z.sql
Bryan Frimin bc78f08334 Harden compliance portal data migrations
Mint certificate and domain GIDs with generate_gid, preserve
org profile and domain rows that lack a trust center, and skip
managed default-domain backfill when no base domain is set.

Signed-off-by: Bryan Frimin <bryan@probo.com>
2026-07-21 15:44:19 +02:00

28 lines
1.2 KiB
SQL

-- Copyright (c) 2026 Probo Inc <hello@probo.com>.
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
-- page_title (later renamed to title) is a full page heading, not an org-name
-- fragment for possessives like "{{name}}'s trust center". Seed from the org
-- name so existing pages keep a sensible default until editors customize it.
ALTER TABLE trust_centers
ADD COLUMN page_title TEXT;
UPDATE trust_centers tc
SET page_title = o.name
FROM organizations o
WHERE tc.organization_id = o.id;
ALTER TABLE trust_centers
ALTER COLUMN page_title SET NOT NULL;