2026-08-03 23:14:26 +02:00
|
|
|
"""Fix RLS on auth tables — disable RLS that was accidentally enabled.
|
2026-08-03 22:32:03 +02:00
|
|
|
|
2026-08-03 23:14:26 +02:00
|
|
|
This migration ONLY disables RLS on auth tables and does NOT enable
|
|
|
|
|
new RLS. RLS on other tables will be added in a later migration
|
|
|
|
|
after the app is confirmed working.
|
2026-08-03 23:06:01 +02:00
|
|
|
|
2026-08-03 22:32:03 +02:00
|
|
|
Revision ID: 0101
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from alembic import op
|
|
|
|
|
|
|
|
|
|
revision = "0101"
|
|
|
|
|
down_revision = "0100"
|
|
|
|
|
branch_labels = None
|
|
|
|
|
depends_on = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade() -> None:
|
2026-08-03 23:14:26 +02:00
|
|
|
# Disable RLS on auth tables (safety measure — these tables must not have RLS)
|
|
|
|
|
op.execute("ALTER TABLE IF EXISTS password_reset_tokens DISABLE ROW LEVEL SECURITY;")
|
|
|
|
|
op.execute("ALTER TABLE IF EXISTS sessions DISABLE ROW LEVEL SECURITY;")
|
2026-08-03 23:06:01 +02:00
|
|
|
op.execute("DROP POLICY IF EXISTS password_reset_tokens_tenant_isolation ON password_reset_tokens;")
|
|
|
|
|
op.execute("DROP POLICY IF EXISTS sessions_tenant_isolation ON sessions;")
|
|
|
|
|
|
2026-08-03 22:32:03 +02:00
|
|
|
|
|
|
|
|
def downgrade() -> None:
|
2026-08-03 23:14:26 +02:00
|
|
|
pass
|