Skip to content

Commit

Permalink
fix: Update downgrade path for migration to remove sl_tables (apache#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sadpandajoe authored Jun 3, 2024
1 parent 8b64967 commit bc9eab9
Showing 1 changed file with 82 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,21 @@ def upgrade():


def downgrade():
op.create_table(
"sl_dataset_users",
sa.Column("dataset_id", sa.INTEGER(), nullable=False),
sa.Column("user_id", sa.INTEGER(), nullable=False),
sa.ForeignKeyConstraint(
["dataset_id"],
["sl_datasets.id"],
),
sa.ForeignKeyConstraint(
["user_id"],
["ab_user.id"],
),
sa.PrimaryKeyConstraint("dataset_id", "user_id"),
)
op.create_table(
"sl_datasets",
sa.Column("uuid", sa.NUMERIC(precision=16), nullable=True),
sa.Column("created_on", sa.DATETIME(), nullable=True),
sa.Column("changed_on", sa.DATETIME(), nullable=True),
sa.Column("id", sa.INTEGER(), nullable=False),
sa.Column("database_id", sa.INTEGER(), nullable=False),
sa.Column("is_physical", sa.BOOLEAN(), nullable=True),
sa.Column("is_managed_externally", sa.BOOLEAN(), nullable=False),
sa.Column("name", sa.TEXT(), nullable=True),
sa.Column("expression", sa.TEXT(), nullable=True),
sa.Column("external_url", sa.TEXT(), nullable=True),
sa.Column("extra_json", sa.TEXT(), nullable=True),
sa.Column("created_by_fk", sa.INTEGER(), nullable=True),
sa.Column("changed_by_fk", sa.INTEGER(), nullable=True),
sa.Column("uuid", sa.Numeric(precision=16), nullable=True),
sa.Column("created_on", sa.DateTime(), nullable=True),
sa.Column("changed_on", sa.DateTime(), nullable=True),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("database_id", sa.Integer(), nullable=False),
sa.Column("is_physical", sa.Boolean(), nullable=True),
sa.Column("is_managed_externally", sa.Boolean(), nullable=False),
sa.Column("name", sa.Text(), nullable=True),
sa.Column("expression", sa.Text(), nullable=True),
sa.Column("external_url", sa.Text(), nullable=True),
sa.Column("extra_json", sa.Text(), nullable=True),
sa.Column("created_by_fk", sa.Integer(), nullable=True),
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(
["changed_by_fk"],
["ab_user.id"],
Expand All @@ -87,19 +73,19 @@ def downgrade():
)
op.create_table(
"sl_tables",
sa.Column("uuid", sa.NUMERIC(precision=16), nullable=True),
sa.Column("created_on", sa.DATETIME(), nullable=True),
sa.Column("changed_on", sa.DATETIME(), nullable=True),
sa.Column("id", sa.INTEGER(), nullable=False),
sa.Column("database_id", sa.INTEGER(), nullable=False),
sa.Column("is_managed_externally", sa.BOOLEAN(), nullable=False),
sa.Column("catalog", sa.TEXT(), nullable=True),
sa.Column("schema", sa.TEXT(), nullable=True),
sa.Column("name", sa.TEXT(), nullable=True),
sa.Column("external_url", sa.TEXT(), nullable=True),
sa.Column("extra_json", sa.TEXT(), nullable=True),
sa.Column("created_by_fk", sa.INTEGER(), nullable=True),
sa.Column("changed_by_fk", sa.INTEGER(), nullable=True),
sa.Column("uuid", sa.Numeric(precision=16), nullable=True),
sa.Column("created_on", sa.DateTime(), nullable=True),
sa.Column("changed_on", sa.DateTime(), nullable=True),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("database_id", sa.Integer(), nullable=False),
sa.Column("is_managed_externally", sa.Boolean(), nullable=False),
sa.Column("catalog", sa.Text(), nullable=True),
sa.Column("schema", sa.Text(), nullable=True),
sa.Column("name", sa.Text(), nullable=True),
sa.Column("external_url", sa.Text(), nullable=True),
sa.Column("extra_json", sa.Text(), nullable=True),
sa.Column("created_by_fk", sa.Integer(), nullable=True),
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(
["changed_by_fk"],
["ab_user.id"],
Expand All @@ -116,23 +102,61 @@ def downgrade():
sa.UniqueConstraint("uuid"),
)
op.create_table(
"sl_dataset_columns",
sa.Column("dataset_id", sa.INTEGER(), nullable=False),
sa.Column("column_id", sa.INTEGER(), nullable=False),
"sl_columns",
sa.Column("uuid", sa.Numeric(precision=16), nullable=True),
sa.Column("created_on", sa.DateTime(), nullable=True),
sa.Column("changed_on", sa.DateTime(), nullable=True),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("is_aggregation", sa.Boolean(), nullable=False),
sa.Column("is_additive", sa.Boolean(), nullable=False),
sa.Column("is_dimensional", sa.Boolean(), nullable=False),
sa.Column("is_filterable", sa.Boolean(), nullable=False),
sa.Column("is_increase_desired", sa.Boolean(), nullable=False),
sa.Column("is_managed_externally", sa.Boolean(), nullable=False),
sa.Column("is_partition", sa.Boolean(), nullable=False),
sa.Column("is_physical", sa.Boolean(), nullable=False),
sa.Column("is_temporal", sa.Boolean(), nullable=False),
sa.Column("is_spatial", sa.Boolean(), nullable=False),
sa.Column("name", sa.Text(), nullable=True),
sa.Column("type", sa.Text(), nullable=True),
sa.Column("unit", sa.Text(), nullable=True),
sa.Column("expression", sa.Text(), nullable=True),
sa.Column("description", sa.Text(), nullable=True),
sa.Column("warning_text", sa.Text(), nullable=True),
sa.Column("external_url", sa.Text(), nullable=True),
sa.Column("extra_json", sa.Text(), nullable=True),
sa.Column("created_by_fk", sa.Integer(), nullable=True),
sa.Column("changed_by_fk", sa.Integer(), nullable=True),
sa.Column("advanced_data_type", sa.Text(), nullable=True),
sa.ForeignKeyConstraint(
["column_id"],
["sl_columns.id"],
["changed_by_fk"],
["ab_user.id"],
),
sa.ForeignKeyConstraint(
["created_by_fk"],
["ab_user.id"],
),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("uuid"),
)
op.create_table(
"sl_dataset_users",
sa.Column("dataset_id", sa.Integer(), nullable=False),
sa.Column("user_id", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["dataset_id"],
["sl_datasets.id"],
),
sa.PrimaryKeyConstraint("dataset_id", "column_id"),
sa.ForeignKeyConstraint(
["user_id"],
["ab_user.id"],
),
sa.PrimaryKeyConstraint("dataset_id", "user_id"),
)
op.create_table(
"sl_dataset_tables",
sa.Column("dataset_id", sa.INTEGER(), nullable=False),
sa.Column("table_id", sa.INTEGER(), nullable=False),
sa.Column("dataset_id", sa.Integer(), nullable=False),
sa.Column("table_id", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["dataset_id"],
["sl_datasets.id"],
Expand All @@ -145,8 +169,8 @@ def downgrade():
)
op.create_table(
"sl_table_columns",
sa.Column("table_id", sa.INTEGER(), nullable=False),
sa.Column("column_id", sa.INTEGER(), nullable=False),
sa.Column("table_id", sa.Integer(), nullable=False),
sa.Column("column_id", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["column_id"],
["sl_columns.id"],
Expand All @@ -158,40 +182,16 @@ def downgrade():
sa.PrimaryKeyConstraint("table_id", "column_id"),
)
op.create_table(
"sl_columns",
sa.Column("uuid", sa.NUMERIC(precision=16), nullable=True),
sa.Column("created_on", sa.DATETIME(), nullable=True),
sa.Column("changed_on", sa.DATETIME(), nullable=True),
sa.Column("id", sa.INTEGER(), nullable=False),
sa.Column("is_aggregation", sa.BOOLEAN(), nullable=False),
sa.Column("is_additive", sa.BOOLEAN(), nullable=False),
sa.Column("is_dimensional", sa.BOOLEAN(), nullable=False),
sa.Column("is_filterable", sa.BOOLEAN(), nullable=False),
sa.Column("is_increase_desired", sa.BOOLEAN(), nullable=False),
sa.Column("is_managed_externally", sa.BOOLEAN(), nullable=False),
sa.Column("is_partition", sa.BOOLEAN(), nullable=False),
sa.Column("is_physical", sa.BOOLEAN(), nullable=False),
sa.Column("is_temporal", sa.BOOLEAN(), nullable=False),
sa.Column("is_spatial", sa.BOOLEAN(), nullable=False),
sa.Column("name", sa.TEXT(), nullable=True),
sa.Column("type", sa.TEXT(), nullable=True),
sa.Column("unit", sa.TEXT(), nullable=True),
sa.Column("expression", sa.TEXT(), nullable=True),
sa.Column("description", sa.TEXT(), nullable=True),
sa.Column("warning_text", sa.TEXT(), nullable=True),
sa.Column("external_url", sa.TEXT(), nullable=True),
sa.Column("extra_json", sa.TEXT(), nullable=True),
sa.Column("created_by_fk", sa.INTEGER(), nullable=True),
sa.Column("changed_by_fk", sa.INTEGER(), nullable=True),
sa.Column("advanced_data_type", sa.TEXT(), nullable=True),
"sl_dataset_columns",
sa.Column("dataset_id", sa.Integer(), nullable=False),
sa.Column("column_id", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["changed_by_fk"],
["ab_user.id"],
["column_id"],
["sl_columns.id"],
),
sa.ForeignKeyConstraint(
["created_by_fk"],
["ab_user.id"],
["dataset_id"],
["sl_datasets.id"],
),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("uuid"),
sa.PrimaryKeyConstraint("dataset_id", "column_id"),
)

0 comments on commit bc9eab9

Please sign in to comment.