Skip to content

Commit bdf68ee

Browse files
committed
fix: adjust schema idempotency
1 parent b373938 commit bdf68ee

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

db/migrate/20260419000001_fix_schema_migrations_rls.rb

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,10 @@
33
class FixSchemaMigrationsRls < ActiveRecord::Migration[7.2]
44
def up
55
execute "DROP POLICY IF EXISTS schema_migrations_deny_all ON schema_migrations;"
6-
execute "ALTER TABLE schema_migrations NO FORCE ROW LEVEL SECURITY;"
7-
execute "ALTER TABLE schema_migrations DISABLE ROW LEVEL SECURITY;"
86
execute "DROP POLICY IF EXISTS ar_internal_metadata_deny_all ON ar_internal_metadata;"
9-
execute "ALTER TABLE ar_internal_metadata NO FORCE ROW LEVEL SECURITY;"
10-
execute "ALTER TABLE ar_internal_metadata DISABLE ROW LEVEL SECURITY;"
7+
execute "ALTER TABLE schema_migrations DISABLE ROW LEVEL SECURITY;" rescue nil
8+
execute "ALTER TABLE ar_internal_metadata DISABLE ROW LEVEL SECURITY;" rescue nil
119
end
1210

13-
def down
14-
execute "ALTER TABLE schema_migrations ENABLE ROW LEVEL SECURITY;"
15-
execute "ALTER TABLE schema_migrations FORCE ROW LEVEL SECURITY;"
16-
execute "CREATE POLICY schema_migrations_deny_all ON schema_migrations FOR ALL USING (false);"
17-
execute "ALTER TABLE ar_internal_metadata ENABLE ROW LEVEL SECURITY;"
18-
execute "ALTER TABLE ar_internal_metadata FORCE ROW LEVEL SECURITY;"
19-
execute "CREATE POLICY ar_internal_metadata_deny_all ON ar_internal_metadata FOR ALL USING (false);"
20-
end
11+
def down; end
2112
end

0 commit comments

Comments
 (0)