fix(db): retire legacy cad_buildings_pkey — fix migration 92 hotfix (#168) #173
1 changed files with 6 additions and 0 deletions
|
|
@ -503,6 +503,12 @@ BEGIN
|
||||||
WHERE table_schema = 'public' AND table_name = 'cad_buildings'
|
WHERE table_schema = 'public' AND table_name = 'cad_buildings'
|
||||||
) THEN
|
) THEN
|
||||||
ALTER TABLE cad_buildings_new RENAME TO cad_buildings;
|
ALTER TABLE cad_buildings_new RENAME TO cad_buildings;
|
||||||
|
-- First, retire the legacy PK index name that's still attached to
|
||||||
|
-- cad_buildings_old_apr26 (PG does NOT auto-rename PK indexes on
|
||||||
|
-- table rename — pre-K.1 backup left cad_buildings_pkey behind).
|
||||||
|
-- Without this rename, the next line collides with the existing
|
||||||
|
-- index name → 'relation already exists' → tx rollback.
|
||||||
|
ALTER INDEX IF EXISTS cad_buildings_pkey RENAME TO cad_buildings_old_apr26_pkey;
|
||||||
-- Rename indexes to drop the _new suffix
|
-- Rename indexes to drop the _new suffix
|
||||||
ALTER INDEX IF EXISTS cad_buildings_new_pkey RENAME TO cad_buildings_pkey;
|
ALTER INDEX IF EXISTS cad_buildings_new_pkey RENAME TO cad_buildings_pkey;
|
||||||
-- Note: ALTER INDEX RENAME on a PK index also renames the constraint
|
-- Note: ALTER INDEX RENAME on a PK index also renames the constraint
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue