From d33cf6283f30e9abf684a61aaad8ba513871d8ae Mon Sep 17 00:00:00 2001 From: Michael Hostettler Date: Fri, 25 Oct 2024 16:39:35 -0700 Subject: [PATCH 1/3] PIM-1766: Updated configmaps and create database script with new database name --- .../database/cirras.ddl.create_database.sql | 14 +++++++------- openshift/cirras-underwriting-api-configmap.yaml | 2 +- .../cirras-underwriting-liquibase-configmap.yaml | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cirras-underwriting-liquibase/db_preconditions/database/cirras.ddl.create_database.sql b/cirras-underwriting-liquibase/db_preconditions/database/cirras.ddl.create_database.sql index 9a31e089..ceea7558 100644 --- a/cirras-underwriting-liquibase/db_preconditions/database/cirras.ddl.create_database.sql +++ b/cirras-underwriting-liquibase/db_preconditions/database/cirras.ddl.create_database.sql @@ -1,16 +1,16 @@ --- Database: cirras${ENV} +-- Database: pituw${ENV} --- DROP DATABASE "cirras${ENV}"; +-- DROP DATABASE "pituw${ENV}"; -CREATE DATABASE "cirras${ENV}" +CREATE DATABASE "pituw${ENV}" WITH OWNER = postgres TABLESPACE = pg_default CONNECTION LIMIT = -1; -COMMENT ON DATABASE "cirras${ENV}" - IS 'cirras${ENV} database containing schemas used by cirras applications and services.'; +COMMENT ON DATABASE "pituw${ENV}" + IS 'pituw${ENV} database containing schemas used by production insurance applications and services.'; -GRANT TEMPORARY, CONNECT ON DATABASE "cirras${ENV}" TO PUBLIC; +GRANT TEMPORARY, CONNECT ON DATABASE "pituw${ENV}" TO PUBLIC; -GRANT ALL ON DATABASE "cirras${ENV}" TO postgres; \ No newline at end of file +GRANT ALL ON DATABASE "pituw${ENV}" TO postgres; \ No newline at end of file diff --git a/openshift/cirras-underwriting-api-configmap.yaml b/openshift/cirras-underwriting-api-configmap.yaml index e39f0858..9fc501ef 100644 --- a/openshift/cirras-underwriting-api-configmap.yaml +++ b/openshift/cirras-underwriting-api-configmap.yaml @@ -16,7 +16,7 @@ data: WEBADE_USERNAME: '#{WEBADE_USERNAME}#' CIRRAS_UNDERWRITING_REST_SECRET: '#{CIRRAS_UNDERWRITING_REST_SECRET}#' POSTGRES_URL: >- - jdbc:postgresql://crunchy-postgres-#{ENV}#-pgbouncer.#{NAMESPACE}#.svc.cluster.local/cirras#{ENV}# + jdbc:postgresql://crunchy-postgres-#{ENV}#-pgbouncer.#{NAMESPACE}#.svc.cluster.local/pituw#{ENV}# WEBADE_PASSWORD: '#{WEBADE_PASSWORD}#' WEBADE_GET_TOKEN_URL: '#{WEBADE_GET_TOKEN_URL}#' WEBADE_OAUTH2_AUTHORIZE_URL: '#{WEBADE_OAUTH2_AUTHORIZE_URL}#' diff --git a/openshift/cirras-underwriting-liquibase-configmap.yaml b/openshift/cirras-underwriting-liquibase-configmap.yaml index 59006879..8bc38511 100644 --- a/openshift/cirras-underwriting-liquibase-configmap.yaml +++ b/openshift/cirras-underwriting-liquibase-configmap.yaml @@ -16,6 +16,6 @@ immutable: false data: LIQUIBASE_COMMAND_USERNAME: '#{POSTGRES_ADMIN_USERNAME}#' LIQUIBASE_COMMAND_PASSWORD: '#{POSTGRES_ADMIN_PASSWORD}#' - LIQUIBASE_COMMAND_URL: jdbc:postgresql://crunchy-postgres-#{ENV}#-pgbouncer.#{NAMESPACE}#.svc.cluster.local/cirras#{ENV}# + LIQUIBASE_COMMAND_URL: jdbc:postgresql://crunchy-postgres-#{ENV}#-pgbouncer.#{NAMESPACE}#.svc.cluster.local/pituw#{ENV}# POSTGRES_PROXY_USER_PASSWORD: '#{POSTGRES_PROXY_USER_PASSWORD}#' POSTGRES_READ_ONLY_PASSWORD: '#{POSTGRES_READ_ONLY_PASSWORD}#' From 273c395e52ea8eb43b96df53cc5555f93675cf8c Mon Sep 17 00:00:00 2001 From: Michael Hostettler Date: Mon, 28 Oct 2024 10:02:26 -0700 Subject: [PATCH 2/3] PIM-1766: Added release script to rename the database and moved other scripts to 01 folder --- cirras-underwriting-liquibase/changelog.json | 4 ++-- .../scripts/03_00_xx/03_05_00/00/Readme.txt | 23 +++++++++++++++++++ .../cirras.cuws.03_05_00_01.ddl.json} | 0 .../cirras.cuws.03_05_00_01.dml.json} | 0 .../ddl/grants/cuws.ddl.apply_grants.sql | 0 ...r.declared_yield_contract_cmdty_forage.sql | 0 .../tables/cuws.alter.inventory_unseeded.sql | 0 ...ws.create.declared_yield_rollup_forage.sql | 0 ...ws.insert.declared_yield_rollup_forage.sql | 0 ...e.declared_yield_contract_cmdty_forage.sql | 0 10 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/Readme.txt rename cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/{00/cirras.cuws.03_05_00_00.ddl.json => 01/cirras.cuws.03_05_00_01.ddl.json} (100%) rename cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/{00/cirras.cuws.03_05_00_00.dml.json => 01/cirras.cuws.03_05_00_01.dml.json} (100%) rename cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/{00 => 01}/ddl/grants/cuws.ddl.apply_grants.sql (100%) rename cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/{00 => 01}/ddl/tables/cuws.alter.declared_yield_contract_cmdty_forage.sql (100%) rename cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/{00 => 01}/ddl/tables/cuws.alter.inventory_unseeded.sql (100%) rename cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/{00 => 01}/ddl/tables/cuws.create.declared_yield_rollup_forage.sql (100%) rename cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/{00 => 01}/dml/cuws.insert.declared_yield_rollup_forage.sql (100%) rename cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/{00 => 01}/dml/cuws.update.declared_yield_contract_cmdty_forage.sql (100%) diff --git a/cirras-underwriting-liquibase/changelog.json b/cirras-underwriting-liquibase/changelog.json index d8190d80..2d16ba6b 100644 --- a/cirras-underwriting-liquibase/changelog.json +++ b/cirras-underwriting-liquibase/changelog.json @@ -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"} } ] } diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/Readme.txt b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/Readme.txt new file mode 100644 index 00000000..057dd0c9 --- /dev/null +++ b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/Readme.txt @@ -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 diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/cirras.cuws.03_05_00_00.ddl.json b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/cirras.cuws.03_05_00_01.ddl.json similarity index 100% rename from cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/cirras.cuws.03_05_00_00.ddl.json rename to cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/cirras.cuws.03_05_00_01.ddl.json diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/cirras.cuws.03_05_00_00.dml.json b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/cirras.cuws.03_05_00_01.dml.json similarity index 100% rename from cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/cirras.cuws.03_05_00_00.dml.json rename to cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/cirras.cuws.03_05_00_01.dml.json diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/ddl/grants/cuws.ddl.apply_grants.sql b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/ddl/grants/cuws.ddl.apply_grants.sql similarity index 100% rename from cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/ddl/grants/cuws.ddl.apply_grants.sql rename to cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/ddl/grants/cuws.ddl.apply_grants.sql diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/ddl/tables/cuws.alter.declared_yield_contract_cmdty_forage.sql b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/ddl/tables/cuws.alter.declared_yield_contract_cmdty_forage.sql similarity index 100% rename from cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/ddl/tables/cuws.alter.declared_yield_contract_cmdty_forage.sql rename to cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/ddl/tables/cuws.alter.declared_yield_contract_cmdty_forage.sql diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/ddl/tables/cuws.alter.inventory_unseeded.sql b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/ddl/tables/cuws.alter.inventory_unseeded.sql similarity index 100% rename from cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/ddl/tables/cuws.alter.inventory_unseeded.sql rename to cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/ddl/tables/cuws.alter.inventory_unseeded.sql diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/ddl/tables/cuws.create.declared_yield_rollup_forage.sql b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/ddl/tables/cuws.create.declared_yield_rollup_forage.sql similarity index 100% rename from cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/ddl/tables/cuws.create.declared_yield_rollup_forage.sql rename to cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/ddl/tables/cuws.create.declared_yield_rollup_forage.sql diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/dml/cuws.insert.declared_yield_rollup_forage.sql b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/dml/cuws.insert.declared_yield_rollup_forage.sql similarity index 100% rename from cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/dml/cuws.insert.declared_yield_rollup_forage.sql rename to cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/dml/cuws.insert.declared_yield_rollup_forage.sql diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/dml/cuws.update.declared_yield_contract_cmdty_forage.sql b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/dml/cuws.update.declared_yield_contract_cmdty_forage.sql similarity index 100% rename from cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/dml/cuws.update.declared_yield_contract_cmdty_forage.sql rename to cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/01/dml/cuws.update.declared_yield_contract_cmdty_forage.sql From b90e091dccc47fe4657218143ca933492bfa3a99 Mon Sep 17 00:00:00 2001 From: Michael Hostettler Date: Mon, 28 Oct 2024 10:49:34 -0700 Subject: [PATCH 3/3] PIM-1766: Added step to shutdown the uw api and jasper api --- .../scripts/03_00_xx/03_05_00/00/Readme.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/Readme.txt b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/Readme.txt index 057dd0c9..f944e386 100644 --- a/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/Readme.txt +++ b/cirras-underwriting-liquibase/scripts/03_00_xx/03_05_00/00/Readme.txt @@ -6,6 +6,10 @@ DLVR: pituwdlvr TEST: pituwtest PROD: pituwprod +--Before running the rename statement, shutdown these apis: + - UW API + - Jasper API + --Rename sql has to be run: ALTER DATABASE old_database_name RENAME TO new_database_name; DEV: ALTER DATABASE cirrasdev RENAME TO pituwdev;