Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: remove built-in prior backup check rules from review config (#18472)

Danny Xuc8ced6f37f17
diff --git a/backend/migrator/migration/3.13/0007##plan_check_ddl_dml_consolidation.sql b/backend/migrator/migration/3.13/0007##plan_check_ddl_dml_consolidation.sql
index 968fbf3bb2..7ed29a7468 100644
--- a/backend/migrator/migration/3.13/0007##plan_check_ddl_dml_consolidation.sql
+++ b/backend/migrator/migration/3.13/0007##plan_check_ddl_dml_consolidation.sql
@@ -12,7 +12,9 @@ UPDATE plan_check_run
SET config = config - 'changeDatabaseType'
WHERE config ? 'changeDatabaseType';
--- Remove disallow-mix rules from review_config if they exist
+-- Remove disallow-mix rules and built-in rules from review_config if they exist.
+-- Built-in rules (like prior-backup-check) are automatically injected by GetBuiltinRules()
+-- and should never be stored in the database.
UPDATE review_config
SET payload = jsonb_set(
payload,
@@ -22,7 +24,9 @@ SET payload = jsonb_set(
FROM jsonb_array_elements(payload->'sqlReviewRules') r
WHERE r->>'type' NOT IN (
'statement.disallow-mix-in-ddl',
- 'statement.disallow-mix-in-dml'
+ 'statement.disallow-mix-in-dml',
+ 'statement.prior-backup-check',
+ 'builtin.prior-backup-check'
)),
'[]'::jsonb
)
diff --git a/backend/migrator/migration/3.13/0017##update_review_config_rule_type.sql b/backend/migrator/migration/3.13/0017##update_review_config_rule_type.sql
index 697f41a08c..cd8a24b7ae 100644
--- a/backend/migrator/migration/3.13/0017##update_review_config_rule_type.sql
+++ b/backend/migrator/migration/3.13/0017##update_review_config_rule_type.sql
@@ -65,7 +65,6 @@ BEGIN
WHEN 'statement.maximum-join-table-count' THEN jsonb_set(rule, '{type}', to_jsonb('STATEMENT_MAXIMUM_JOIN_TABLE_COUNT'::text))
WHEN 'statement.maximum-statements-in-transaction' THEN jsonb_set(rule, '{type}', to_jsonb('STATEMENT_MAXIMUM_STATEMENTS_IN_TRANSACTION'::text))
WHEN 'statement.join-strict-column-attrs' THEN jsonb_set(rule, '{type}', to_jsonb('STATEMENT_JOIN_STRICT_COLUMN_ATTRS'::text))
- WHEN 'statement.prior-backup-check' THEN jsonb_set(rule, '{type}', to_jsonb('BUILTIN_PRIOR_BACKUP_CHECK'::text))
WHEN 'statement.non-transactional' THEN jsonb_set(rule, '{type}', to_jsonb('STATEMENT_NON_TRANSACTIONAL'::text))
WHEN 'statement.add-column-without-position' THEN jsonb_set(rule, '{type}', to_jsonb('STATEMENT_ADD_COLUMN_WITHOUT_POSITION'::text))
WHEN 'statement.disallow-offline-ddl' THEN jsonb_set(rule, '{type}', to_jsonb('STATEMENT_DISALLOW_OFFLINE_DDL'::text))
@@ -140,7 +139,6 @@ BEGIN
WHEN 'system.function-disallowed-list' THEN jsonb_set(rule, '{type}', to_jsonb('SYSTEM_FUNCTION_DISALLOWED_LIST'::text))
WHEN 'system.function.disallowed-list' THEN jsonb_set(rule, '{type}', to_jsonb('SYSTEM_FUNCTION_DISALLOWED_LIST'::text))
WHEN 'advice.online-migration' THEN jsonb_set(rule, '{type}', to_jsonb('ADVICE_ONLINE_MIGRATION'::text))
- WHEN 'builtin.prior-backup-check' THEN jsonb_set(rule, '{type}', to_jsonb('BUILTIN_PRIOR_BACKUP_CHECK'::text))
WHEN 'engine.mysql.use-innodb' THEN jsonb_set(rule, '{type}', to_jsonb('ENGINE_MYSQL_USE_INNODB'::text))
ELSE rule
END