Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-- -------------------------------------------------------------------------------------------------
-- Database Name: mosip_esignet
-- Database Name: :mosipdbname
-- Table Name : consent_detail
-- Purpose : To store user consent details
--
Expand All @@ -13,7 +13,7 @@
-- ------------------------------------------------------------------------------------------
-- ------------------------------------------------------------------------------------------

\c mosip_esignet
\c :mosipdbname

drop table consent_detail;
drop table consent_history;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
-- -------------------------------------------------------------------------------------------------
-- Database Name: mosip_esignet
-- Database Name: :mosipdbname
-- Table Name : consent_detail
-- Purpose : To store user consent details
--
Expand All @@ -12,7 +12,7 @@
-- Modified Date Modified By Comments / Remarks
-- ------------------------------------------------------------------------------------------
-- ------------------------------------------------------------------------------------------
\c mosip_esignet
\c :mosipdbname

create table consent_detail (
id UUID NOT NULL,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c mosip_esignet
\c :mosipdbname

-- Drop the thumbprint column from the public_key_registry table
ALTER TABLE public_key_registry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c mosip_esignet
\c :mosipdbname

--adding new column thumbprint to public_key_registry
ALTER TABLE public_key_registry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c mosip_esignet
\c :mosipdbname

-- Delete the existing entry for MOCK_BINDING_SERVICE from the key_policy_def
DELETE FROM esignet.KEY_POLICY_DEF WHERE APP_ID = 'MOCK_BINDING_SERVICE';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c mosip_esignet
\c :mosipdbname

truncate table consent_detail;
truncate table consent_history;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c mosip_esignet
\c :mosipdbname

CREATE OR REPLACE FUNCTION is_column_jsonb(
p_table_name text,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c mosip_esignet
\c :mosipdbname

CREATE OR REPLACE FUNCTION is_column_jsonb(
p_table_name text,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c mosip_esignet
\c :mosipdbname

ALTER TABLE client_detail DROP COLUMN additional_config;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\c mosip_esignet
\c :mosipdbname

ALTER TABLE client_detail ADD COLUMN additional_config jsonb;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.

\c mosip_esignet
\c :mosipdbname

DO $$
BEGIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.

\c mosip_esignet
\c :mosipdbname

DO $$
BEGIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.

\c mosip_esignet
\c :mosipdbname

DO $$
BEGIN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.

\c mosip_esignet
\c :mosipdbname

DO $$
BEGIN
Expand Down
3 changes: 2 additions & 1 deletion db_upgrade_script/mosip_esignet/upgrade.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ACTION=upgrade
MOSIP_DB_NAME=
MOSIP_DB_NAME=mosip_esignet
DB_UNAME=esignetuser
DB_SERVERIP=
DB_PORT=
SU_USER=postgres
Expand Down
6 changes: 3 additions & 3 deletions db_upgrade_script/mosip_esignet/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ echo "Action: $ACTION"

# Terminate existing connections
echo "Terminating active connections"
CONN=$(PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "SELECT count(pg_terminate_backend(pg_stat_activity.pid)) FROM pg_stat_activity WHERE datname = '$MOSIP_DB_NAME' AND pid <> pg_backend_pid()";exit;)
CONN=$(PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 -v mosipdbname=$MOSIP_DB_NAME -v dbuname=$DB_UNAME --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -t -c "SELECT count(pg_terminate_backend(pg_stat_activity.pid)) FROM pg_stat_activity WHERE datname = '$MOSIP_DB_NAME' AND pid <> pg_backend_pid()";exit;)
echo "Terminated connections"

# Execute upgrade or rollback
Expand All @@ -30,7 +30,7 @@ if [ "$ACTION" == "upgrade" ]; then
UPGRADE_SCRIPT_FILE="sql/${CURRENT_VERSION}_to_${UPGRADE_VERSION}_upgrade.sql"
if [ -f "$UPGRADE_SCRIPT_FILE" ]; then
echo "Executing upgrade script $UPGRADE_SCRIPT_FILE"
PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -v primary_language_code=$PRIMARY_LANGUAGE_CODE -a -b -f $UPGRADE_SCRIPT_FILE
PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 -v mosipdbname=$MOSIP_DB_NAME -v dbuname=$DB_UNAME --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -v primary_language_code=$PRIMARY_LANGUAGE_CODE -a -b -f $UPGRADE_SCRIPT_FILE
else
echo "Upgrade script not found, exiting."
exit 1
Expand All @@ -40,7 +40,7 @@ elif [ "$ACTION" == "rollback" ]; then
REVOKE_SCRIPT_FILE="sql/${CURRENT_VERSION}_to_${UPGRADE_VERSION}_rollback.sql"
if [ -f "$REVOKE_SCRIPT_FILE" ]; then
echo "Executing rollback script $REVOKE_SCRIPT_FILE"
PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -v primary_language_code=$PRIMARY_LANGUAGE_CODE -a -b -f $REVOKE_SCRIPT_FILE
PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 -v mosipdbname=$MOSIP_DB_NAME -v dbuname=$DB_UNAME --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -v primary_language_code=$PRIMARY_LANGUAGE_CODE -a -b -f $REVOKE_SCRIPT_FILE
else
echo "rollback script not found, exiting."
exit 1
Expand Down
Loading