Skip to content

Commit

Permalink
PIM-1766: Added release script to rename the database and moved other…
Browse files Browse the repository at this point in the history
… scripts to 01 folder
  • Loading branch information
Michael Hostettler committed Oct 28, 2024
1 parent d33cf62 commit 273c395
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cirras-underwriting-liquibase/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
{ "include": {"file": "scripts/03_00_xx/03_01_01/00/cirras.cuws.03_01_01_00.drop.ddl.json"} },
{ "include": {"file": "scripts/03_00_xx/03_02_00/00/cirras.cuws.03_02_00_00.ddl.json"} },
{ "include": {"file": "scripts/03_00_xx/03_03_00/00/cirras.cuws.03_03_00_00.ddl.json"} },
{ "include": {"file": "scripts/03_00_xx/03_05_00/00/cirras.cuws.03_05_00_00.ddl.json"} },
{ "include": {"file": "scripts/03_00_xx/03_05_00/00/cirras.cuws.03_05_00_00.dml.json"} }
{ "include": {"file": "scripts/03_00_xx/03_05_00/01/cirras.cuws.03_05_00_01.ddl.json"} },
{ "include": {"file": "scripts/03_00_xx/03_05_00/01/cirras.cuws.03_05_00_01.dml.json"} }
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--The database needs to be renamed.

DEV: pituwdev
QA: pituwqa
DLVR: pituwdlvr
TEST: pituwtest
PROD: pituwprod

--Rename sql has to be run: ALTER DATABASE old_database_name RENAME TO new_database_name;

DEV: ALTER DATABASE cirrasdev RENAME TO pituwdev;
QA: ALTER DATABASE cirrasqa RENAME TO pituwqa;
DLVR: ALTER DATABASE cirrasdlvr RENAME TO pituwdlvr;
TEST: ALTER DATABASE cirrastest RENAME TO pituwtest;
PROD: ALTER DATABASE cirrasprod RENAME TO pituwprod;


Possible Error if there are sessions using the database:
There are X other sessions using the database.database "cirras_dev" is being accessed by other users
ERROR: database "cirrasdev" is being accessed by other users
SQL state: 55006

Solution: SELECT pg_terminate_backend( pid ) FROM pg_stat_activity WHERE pid <> pg_backend_pid( ) AND datname = 'cirrasdev'; //WHERE cirrasdev is the old database name

0 comments on commit 273c395

Please sign in to comment.