"""Fix FORCE RLS on global tables. Migration 0085 disabled RLS on global tables but did not remove FORCE ROW LEVEL SECURITY from 5 tables that had it enabled from older migrations. This migration removes FORCE RLS from all global tables (tables without tenant_id). Revision ID: 0086 Revises: 0085 """ from __future__ import annotations from alembic import op revision = "0086" down_revision = "0085" branch_labels = None depends_on = None GLOBAL_TABLES_WITH_FORCE_RLS = [ "api_tokens", "sequences", "sessions", "tenant_plugin_activation", "user_tenants", ] def upgrade() -> None: for table in GLOBAL_TABLES_WITH_FORCE_RLS: op.execute(f"ALTER TABLE public.{table} NO FORCE ROW LEVEL SECURITY") def downgrade() -> None: for table in GLOBAL_TABLES_WITH_FORCE_RLS: op.execute(f"ALTER TABLE public.{table} FORCE ROW LEVEL SECURITY")