Skip to content

Commit

Permalink
MOSIP-32075 : DB attributes of PMS are hardcoded in db_scripts (sql s…
Browse files Browse the repository at this point in the history
…cripts)

Signed-off-by: sudeep <[email protected]>
  • Loading branch information
Sudeep7353 committed Jan 8, 2025
1 parent 60b93c8 commit 5319332
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 45 deletions.
2 changes: 1 addition & 1 deletion db_upgrade_scripts/mosip_pms/sql/1.1.4_release.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- Modified Date Modified By Comments / Remarks
-- -------------------------------------------------------------------------------------------------

\c mosip_pms sysadmin
\c :mosipdbname sysadmin


\ir ../ddl/pms-partner_policy_credential_type.sql
Expand Down
2 changes: 1 addition & 1 deletion db_upgrade_scripts/mosip_pms/sql/1.1.4_revoke.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
-- Modified Date Modified By Comments / Remarks
-- -------------------------------------------------------------------------------------------------

\c mosip_pms sysadmin
\c :mosipdbname sysadmin

DROP TABLE IF EXISTS pms.partner_policy_credential_type;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- Modified Date Modified By Comments / Remarks
-- -------------------------------------------------------------------------------------------------

\c mosip_pms sysadmin
\c :mosipdbname sysadmin

ALTER TABLE pms.partner ADD COLUMN logo_url character varying(256);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- Modified Date Modified By Comments / Remarks
-- -------------------------------------------------------------------------------------------------

\c mosip_pms sysadmin
\c :mosipdbname sysadmin

ALTER TABLE pms.partner DROP COLUMN logo_url;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@



\c mosip_pms sysadmin
\c :mosipdbname sysadmin

INSERT INTO pms.partner_type (code,partner_description,is_policy_required,is_active,cr_by,cr_dtimes,upd_by,upd_dtimes,is_deleted,del_dtimes) VALUES
('Binding_Partner','Binding Partner',true,true,'superadmin',now(),NULL,NULL,false,NULL) ON CONFLICT (code) DO NOTHING;
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- Modified Date Modified By Comments / Remarks
-- -------------------------------------------------------------------------------------------------

\c mosip_pms sysadmin
\c :mosipdbname sysadmin

ALTER TABLE pms.partner DROP COLUMN logo_url;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@



\c mosip_pms sysadmin
\c :mosipdbname sysadmin

DELETE FROM pms.partner_type WHERE code = 'Binding_Partner';
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- Modified Date Modified By Comments / Remarks
-- -------------------------------------------------------------------------------------------------

\c mosip_pms sysadmin
\c :mosipdbname sysadmin

ALTER TABLE pms.partner ADD COLUMN logo_url character varying(256);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
\c :mosipdbname sysadmin
UPDATE pms.auth_policy
SET policy_file_id='{"dataSharePolicies":{"typeOfShare":"direct","validForInMinutes":"30","transactionsAllowed":"2","encryptionType":"Partner Based","shareDomain":"datashare.datashare","source":"ID Repository"},"shareableAttributes":[{"attributeName":"fullName","source":[{"attribute":"fullName"}],"encrypted":true},{"attributeName":"dateOfBirth","source":[{"attribute":"dateOfBirth"}],"encrypted":false,"format":"YYYY"},{"attributeName":"gender","source":[{"attribute":"gender"}],"encrypted":false},{"attributeName":"phone","source":[{"attribute":"phone"}],"encrypted":false},{"attributeName":"email","source":[{"attribute":"email"}],"encrypted":false},{"attributeName":"addressLine1","source":[{"attribute":"addressLine1"}],"encrypted":false},{"attributeName":"addressLine2","source":[{"attribute":"addressLine2"}],"encrypted":false},{"attributeName":"addressLine3","source":[{"attribute":"addressLine3"}],"encrypted":false},{"attributeName":"region","source":[{"attribute":"region"}],"encrypted":false},{"attributeName":"province","source":[{"attribute":"province"}],"encrypted":false},{"attributeName":"city","source":[{"attribute":"city"}],"encrypted":false},{"attributeName":"UIN","source":[{"attribute":"UIN"}],"encrypted":false},{"attributeName":"PCN","source":[{"attribute":"VID","filter":[{"type":"PERPETUAL"}]}],"encrypted":false,"format":"RETRIEVE"},{"attributeName":"postalCode","source":[{"attribute":"postalCode"}],"encrypted":false},{"attributeName":"bestTwoFingers","group":"CBEFF","source":[{"attribute":"individualBiometrics","filter":[{"type":"Finger"}]}],"encrypted":false,"format":"bestTwoFingers"},{"attributeName":"Signature","source":[{"attribute":"proofOfAddress"}],"encrypted":false},{"attributeName":"biometrics","group":"CBEFF","source":[{"attribute":"individualBiometrics","filter":[{"type":"Face"},{"type":"Finger","subType":["Left Thumb","Right Thumb"]}]}],"encrypted":false,"format":"extraction"}]}'
WHERE id='mpolicy-default-PDFCard';
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
\c :mosipdbname sysadmin
UPDATE pms.auth_policy
SET policy_file_id='{"dataSharePolicies":{"typeOfShare":"Data Share","validForInMinutes":"30","transactionsAllowed":"2","encryptionType":"Partner Based","shareDomain":"datashare.datashare","source":"ID Repository"},"shareableAttributes":[{"attributeName":"fullName","source":[{"attribute":"fullName","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"dateOfBirth","source":[{"attribute":"dateOfBirth"}],"encrypted":false},{"attributeName":"dob","source":[{"attribute":"dateOfBirth"}],"encrypted":false},{"attributeName":"gender","source":[{"attribute":"gender","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"phone","source":[{"attribute":"phone"}],"encrypted":false},{"attributeName":"email","source":[{"attribute":"email"}],"encrypted":false},{"attributeName":"addressLine1","source":[{"attribute":"addressLine1","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"addressLine2","source":[{"attribute":"addressLine2","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"addressLine3","source":[{"attribute":"addressLine3","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"region","source":[{"attribute":"region","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"province","source":[{"attribute":"province","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"city","source":[{"attribute":"city","filter":[{"language":"eng"}]}],"encrypted":false},{"attributeName":"UIN","source":[{"attribute":"UIN"}],"encrypted":false},{"attributeName":"postalCode","source":[{"attribute":"postalCode"}],"encrypted":false},{"attributeName":"biometrics","group":"CBEFF","source":[{"attribute":"individualBiometrics","filter":[{"type":"Face"},{"type":"Finger","subType":["Left Thumb","Right Thumb"]}]}],"encrypted":true,"format":"extraction"}]}'
WHERE id='mpolicy-default-PDFCard';
2 changes: 1 addition & 1 deletion db_upgrade_scripts/mosip_pms/sql/1.2.0_release.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-- 15-07-2022 Nagarjuna K Merged 1.2.0.1 changes to 1.2.0 release patch
-- -------------------------------------------------------------------------------------------------

\c mosip_pms sysadmin
\c :mosipdbname sysadmin


\ir ../ddl/pms-device_detail.sql
Expand Down
2 changes: 1 addition & 1 deletion db_upgrade_scripts/mosip_pms/sql/1.2.0_revoke.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- Modified Date Modified By Comments / Remarks
-- --------------------------------------------------------------------------------------------------

\c mosip_pms sysadmin
\c :mosipdbname sysadmin

ALTER TABLE pms.device_detail DROP CONSTRAINT fk_devdtl_id;

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
--
-- Modified Date Modified By Comments / Remarks
-- -------------------------------------------------------------------------------------------------

\c :mosipdbname sysadmin
--Dropping unique index from pms.device_detail table
DROP INDEX IF EXISTS pms.uk_devdtl_make_model_approval_status;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
--
-- Modified Date Modified By Comments / Remarks
-- -------------------------------------------------------------------------------------------------

\c :mosipdbname
-- Dropping unique constraint from pms.device_detail table
ALTER TABLE pms.device_detail DROP CONSTRAINT uk_devdtl_id;

Expand Down
18 changes: 9 additions & 9 deletions db_upgrade_scripts/mosip_pms/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ 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"
if [[ "$UPGRADE_VERSION" == "1.2.0.1-B1" && "$CURRENT_VERSION" == "1.1.5.5" ]]; then
echo "Creating dml directory."
mkdir dml
PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$SOURCE_DB1_NAME -a -b -f $SOURCE_DB1_SUPPORT_FILE
PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$SOURCE_DB2_NAME -a -b -f $SOURCE_DB2_SUPPORT_FILE
fi
PGPASSWORD=$SU_USER_PWD psql -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $UPGRADE_SCRIPT_FILE
if [[ "$UPGRADE_VERSION" == "1.2.0.1-B1" && "$CURRENT_VERSION" == "1.1.5.5" ]]; then
echo "Creating dml directory."
mkdir dml
PGPASSWORD=$SU_USER_PWD psql -v mosipdbname=$MOSIP_DB_NAME -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$SOURCE_DB1_NAME -a -b -f $SOURCE_DB1_SUPPORT_FILE
PGPASSWORD=$SU_USER_PWD psql -v mosipdbname=$MOSIP_DB_NAME -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$SOURCE_DB2_NAME -a -b -f $SOURCE_DB2_SUPPORT_FILE
fi
PGPASSWORD=$SU_USER_PWD psql -v mosipdbname=$MOSIP_DB_NAME -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $UPGRADE_SCRIPT_FILE
else
echo "Upgrade script not found, exiting."
exit 1
Expand All @@ -50,9 +50,9 @@ 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 -a -b -f $REVOKE_SCRIPT_FILE
PGPASSWORD=$SU_USER_PWD psql -v mosipdbname=$MOSIP_DB_NAME -v ON_ERROR_STOP=1 --username=$SU_USER --host=$DB_SERVERIP --port=$DB_PORT --dbname=$DEFAULT_DB_NAME -a -b -f $REVOKE_SCRIPT_FILE
else
echo "rollback script not found, exiting."
echo "Rollback script not found, exiting."
exit 1
fi
else
Expand Down

0 comments on commit 5319332

Please sign in to comment.