Skip to content

Commit

Permalink
Add migration.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Sep 19, 2023
1 parent 8c1ff55 commit df65687
Showing 1 changed file with 90 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"""Remove ExternalIntegrationLink.
Revision ID: 5d71a80073d5
Revises: 1c566151741f
Create Date: 2023-09-13 15:23:07.566404+00:00
"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "5d71a80073d5"
down_revision = "1c566151741f"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.drop_index(
"ix_externalintegrationslinks_external_integration_id",
table_name="externalintegrationslinks",
)
op.drop_index(
"ix_externalintegrationslinks_library_id",
table_name="externalintegrationslinks",
)
op.drop_index(
"ix_externalintegrationslinks_other_integration_id",
table_name="externalintegrationslinks",
)
op.drop_index(
"ix_externalintegrationslinks_purpose", table_name="externalintegrationslinks"
)
op.drop_table("externalintegrationslinks")


def downgrade() -> None:
op.create_table(
"externalintegrationslinks",
sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column(
"external_integration_id", sa.INTEGER(), autoincrement=False, nullable=True
),
sa.Column("library_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column(
"other_integration_id", sa.INTEGER(), autoincrement=False, nullable=True
),
sa.Column("purpose", sa.VARCHAR(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(
["external_integration_id"],
["externalintegrations.id"],
name="externalintegrationslinks_external_integration_id_fkey",
),
sa.ForeignKeyConstraint(
["library_id"],
["libraries.id"],
name="externalintegrationslinks_library_id_fkey",
),
sa.ForeignKeyConstraint(
["other_integration_id"],
["externalintegrations.id"],
name="externalintegrationslinks_other_integration_id_fkey",
),
sa.PrimaryKeyConstraint("id", name="externalintegrationslinks_pkey"),
)
op.create_index(
"ix_externalintegrationslinks_purpose",
"externalintegrationslinks",
["purpose"],
unique=False,
)
op.create_index(
"ix_externalintegrationslinks_other_integration_id",
"externalintegrationslinks",
["other_integration_id"],
unique=False,
)
op.create_index(
"ix_externalintegrationslinks_library_id",
"externalintegrationslinks",
["library_id"],
unique=False,
)
op.create_index(
"ix_externalintegrationslinks_external_integration_id",
"externalintegrationslinks",
["external_integration_id"],
unique=False,
)

0 comments on commit df65687

Please sign in to comment.