From 336fd7695251d315e64ffe9b49880105a8d09f92 Mon Sep 17 00:00:00 2001 From: srikanthopsmx <57516197+srikanthopsmx@users.noreply.github.com> Date: Wed, 9 Mar 2022 16:40:48 +0530 Subject: [PATCH] OP-12962-OES3.10 analytics drop constraints changes to fix delete application (#275) --- .../migration_v3.9.x_to_v3.10.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/oes-data-migration-scripts/migration_v3.9.x_to_v3.10.py b/scripts/oes-data-migration-scripts/migration_v3.9.x_to_v3.10.py index ed67423c..9010452b 100644 --- a/scripts/oes-data-migration-scripts/migration_v3.9.x_to_v3.10.py +++ b/scripts/oes-data-migration-scripts/migration_v3.9.x_to_v3.10.py @@ -17,6 +17,8 @@ def perform_migration(): print("Altered column verification_type value of table userservicetemplate in opsmdb") print("Alter autopilot db table entropy") updatescript() + print("Alter autopilot db table servicegate and serviceriskanalysis in opsmx db") + updateautopilotconstraints() modifyGit(hosturl) print("Modified config data of Datasource type 'GIT'") modifygitname() @@ -333,6 +335,16 @@ def modifyOpsmxdb(): print("Exception occurred while fetching userservicetemplate data : ", e) raise e +def updateautopilotconstraints(): + try: + cur = opsmxdb_conn.cursor() + cur.execute(" ALTER TABLE serviceriskanalysis DROP CONSTRAINT IF EXISTS fkmef9blhpcxhcj431kcu52nm1e ") + print("Successfully dropped constraint serviceriskanalysis table in autopilot db") + cur.execute(" ALTER TABLE servicegate DROP CONSTRAINT IF EXISTS uk_lk3buh56ebai2gycw560j2oxm ") + print("Successfully dropped constraint servicegate table in autopilot db") + except Exception as e: + print("Exception occured while updating script : ", e) + raise e def updatescript(): try: