You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Prerequisites

Check number of files in each release

cd /git/docker/policy-db-migrator/src/main/docker/config/policyadmin/sql$

ls 0800/upgrade/*.sql | wc -l
96
ls 0900/upgrade/*.sql | wc -l
13

ls 0800/downgrade/*.sql | wc -l
96
ls 0900/downgrade/*.sql | wc -l
13

Upgrade scripts:

/opt/app/policy/bin/prepare_upgrade.sh policyadmin
/opt/app/policy/bin/db-migrator -s policyadmin -o upgrade

Downgrade scripts:

/opt/app/policy/bin/prepare_downgrade.sh policyadmin
/opt/app/policy/bin/db-migrator -s policyadmin -o downgrade -f 0900 -t 0800

Db migrator initialization script:

To run scripts update /oom/kubernetes/policy/resources/config/db_migrator_policy_init.sh with the appropriate calls.

Please ensure the policy version you are deploying is in line with the db migrator schema version.

1. Fresh Install

Number of files run = 109

Tables in policyadmin = 75

Records in policyadmin_schema_changelog = 109

Version in schema_versions: 0900


2. Downgrade to Honolulu (0800)

Modify db_migrator_policy_init.sh - Remove any lines referencing upgrade and add the 2 lines under "Downgrade scripts" 

Number of files run = 13

Tables in policyadmin = 73

Records in policyadmin_schema_changelog = 109+13=122

Version in schema_versions: 0800


3. Upgrade to Istanbul (0900)

Modify db_migrator_policy_init.sh - Remove any lines referencing downgrade and add the 2 lines under "Upgrade scripts" 

Number of files run = 13

Tables in policyadmin = 75

Records in policyadmin_schema_changelog = 122+13=135

Version in schema_versions: 0900


3. Upgrade to Istanbul (0900) without any information in the migration schema

Ensure you are on release 0800. (This may require running a downgrade before starting the test)

Drop db-migrator tables in migration schema:  DROP TABLE schema_versions; DROP TABLE policyadmin_schema_changelog;

Modify db_migrator_policy_init.sh - Remove any lines referencing downgrade and add the 2 lines under "Upgrade scripts" 

Number of files run = 13

Tables in policyadmin = 75

Records in policyadmin_schema_changelog = 135+13(for downgrade prior to upgrade)+13=161

Version in schema_versions: 0900

Test Results

kubectl logs: 

  • No labels