Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: add migration to fix open issues with hasRollout set to true (#19168)
boojack1272636a9e3b
diff --git a/backend/migrator/migration/3.14/0034##fix_open_issue_with_has_rollout.sql b/backend/migrator/migration/3.14/0034##fix_open_issue_with_has_rollout.sqlnew file mode 100644index 0000000000..d7d2b22bdc--- /dev/null+++ b/backend/migrator/migration/3.14/0034##fix_open_issue_with_has_rollout.sql@@ -0,0 +1,21 @@+-- Fix legacy data where issue is not DONE but plan.hasRollout is true.+-- This inconsistency was caused by a race condition in auto rollout creation (BYT-8790).+--+-- When a rollout is created, the expected sequence is:+-- 1. Create tasks for the plan+-- 2. Set plan.config.hasRollout = true+-- 3. Set issue.status = DONE+-- Due to a race condition, step 3 could be skipped.++-- hasRollout is true, tasks exist, but issue is OPEN+-- → The rollout was created, so mark the issue as DONE.+UPDATE issue+SET status = 'DONE'+WHERE status = 'OPEN'+ AND type = 'DATABASE_CHANGE'+ AND plan_id IS NOT NULL+ AND EXISTS (+ SELECT 1 FROM plan+ WHERE plan.id = issue.plan_id+ AND plan.config->>'hasRollout' = 'true'+ );