Fix: drop RLS policy on users before dropping tenant_id column in migration 0037
This commit is contained in:
@@ -135,6 +135,8 @@ def upgrade() -> None:
|
|||||||
# Drop tenant_id
|
# Drop tenant_id
|
||||||
tenant_col_result = conn.execute(sa.text(_column_exists("users", "tenant_id"))).fetchone()
|
tenant_col_result = conn.execute(sa.text(_column_exists("users", "tenant_id"))).fetchone()
|
||||||
if tenant_col_result is not None:
|
if tenant_col_result is not None:
|
||||||
|
# Drop RLS policy that depends on tenant_id
|
||||||
|
op.execute("DROP POLICY IF EXISTS tenant_isolation ON users")
|
||||||
# Drop any indexes on tenant_id first
|
# Drop any indexes on tenant_id first
|
||||||
op.execute("DROP INDEX IF EXISTS ix_users_tenant_id")
|
op.execute("DROP INDEX IF EXISTS ix_users_tenant_id")
|
||||||
op.drop_column("users", "tenant_id")
|
op.drop_column("users", "tenant_id")
|
||||||
|
|||||||
Reference in New Issue
Block a user