Skip to content

Commit

Permalink
fix: Error when downgrading add_catalog_perm_to_tables migration (apa…
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-s-molina committed Aug 9, 2024
1 parent b323bf0 commit fb7f508
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,17 @@
revision = "5f57af97bc3f"
down_revision = "d60591c5515f"

tables = ["tables", "query", "saved_query", "tab_state", "table_schema"]


def upgrade():
op.add_column("tables", sa.Column("catalog", sa.String(length=256), nullable=True))
op.add_column("query", sa.Column("catalog", sa.String(length=256), nullable=True))
op.add_column(
"saved_query",
sa.Column("catalog", sa.String(length=256), nullable=True),
)
op.add_column(
"tab_state",
sa.Column("catalog", sa.String(length=256), nullable=True),
)
op.add_column(
"table_schema",
sa.Column("catalog", sa.String(length=256), nullable=True),
)
for table in tables:
op.add_column(
table,
sa.Column("catalog", sa.String(length=256), nullable=True),
)


def downgrade():
op.drop_column("table_schema", "catalog")
op.drop_column("tab_state", "catalog")
op.drop_column("saved_query", "catalog")
op.drop_column("query", "catalog")
op.drop_column("tables", "catalog")
for table in reversed(tables):
op.drop_column(table, "catalog")
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ def upgrade():


def downgrade():
downgrade_catalog_perms(engines={"postgresql"})
op.drop_column("slices", "catalog_perm")
op.drop_column("tables", "catalog_perm")
downgrade_catalog_perms(engines={"postgresql"})

0 comments on commit fb7f508

Please sign in to comment.