Skip to content
Merged
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
15 changes: 12 additions & 3 deletions db_upgrade_script/mosip_esignet/sql/1.8.0_to_2.0.0_rollback.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

\c mosip_esignet

DELETE FROM esignet.KEY_POLICY_DEF WHERE APP_ID='BASE';
INSERT INTO esignet.KEY_POLICY_DEF(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('BINDING_SERVICE', 1095, 50, 'NA', true, 'mosipadmin', now());
INSERT INTO esignet.KEY_POLICY_DEF(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('MOCK_BINDING_SERVICE', 1095, 50, 'NA', true, 'mosipadmin', now());
DELETE FROM esignet.key_policy_def WHERE APP_ID='BASE';
INSERT INTO esignet.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('BINDING_SERVICE', 1095, 50, 'NA', true, 'mosipadmin', now());
INSERT INTO esignet.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('MOCK_BINDING_SERVICE', 1095, 50, 'NA', true, 'mosipadmin', now());

-- key_policy_def app_ids reverted above, so existing key_alias entries reference policies
-- that no longer exist; truncate so keys regenerate fresh under the restored app_id.
TRUNCATE TABLE esignet.key_alias;

-- Restore consent_detail from the pre-upgrade snapshot, then drop the snapshot table.
TRUNCATE TABLE esignet.consent_detail;
INSERT INTO esignet.consent_detail SELECT * FROM esignet.consent_detail_bkp_1_8_0;
DROP TABLE IF EXISTS esignet.consent_detail_bkp_1_8_0;
16 changes: 13 additions & 3 deletions db_upgrade_script/mosip_esignet/sql/1.8.0_to_2.0.0_upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@

\c mosip_esignet

INSERT INTO esignet.KEY_POLICY_DEF(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('BASE', 1095, 50, 'NA', true, 'mosipadmin', now());
DELETE FROM esignet.KEY_POLICY_DEF WHERE APP_ID='BINDING_SERVICE';
DELETE FROM esignet.KEY_POLICY_DEF WHERE APP_ID='MOCK_BINDING_SERVICE';
INSERT INTO esignet.key_policy_def(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('BASE', 1095, 50, 'NA', true, 'mosipadmin', now());
DELETE FROM esignet.key_policy_def WHERE APP_ID='BINDING_SERVICE';
DELETE FROM esignet.key_policy_def WHERE APP_ID='MOCK_BINDING_SERVICE';

-- key_policy_def app_ids changed above, so existing key_alias entries reference policies
-- that no longer exist; truncate so keys regenerate fresh under the new app_id.
TRUNCATE TABLE esignet.key_alias;

-- Consent data migration: consent_detail structure changed in 2.0.0, so 1.8.0 consent records
-- won't parse there — back them up to a snapshot table before truncating consent_detail.
CREATE TABLE esignet.consent_detail_bkp_1_8_0 AS TABLE esignet.consent_detail;
Comment thread
anushasunkada marked this conversation as resolved.
Comment thread
sacrana0 marked this conversation as resolved.

TRUNCATE TABLE esignet.consent_detail;
Loading