Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update data connectors migrations #443

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ def upgrade() -> None:
referent_schema="storage",
ondelete="CASCADE",
)
op.create_check_constraint(
"either_project_id_or_data_connector_id_is_set",
"entity_slugs",
"CAST (project_id IS NOT NULL AS int) + CAST (data_connector_id IS NOT NULL AS int) BETWEEN 0 AND 1",
schema="common",
)
op.create_table(
"data_connector_secrets",
sa.Column("user_id", sa.String(length=36), nullable=False),
Expand Down Expand Up @@ -135,6 +141,8 @@ def downgrade() -> None:
schema="storage",
)
op.drop_table("data_connector_secrets", schema="storage")
op.drop_constraint("either_project_id_or_data_connector_id_is_set", "entity_slugs", schema="common", type_="check")
op.execute("DELETE FROM common.entity_slugs WHERE entity_slugs.data_connector_id IS NOT NULL")
op.drop_constraint("entity_slugs_data_connector_id_fk", "entity_slugs", schema="common", type_="foreignkey")
op.drop_index(op.f("ix_common_entity_slugs_data_connector_id"), table_name="entity_slugs", schema="common")
op.alter_column("entity_slugs", "project_id", existing_type=sa.String(length=26), nullable=False, schema="common")
Expand Down
Loading