Skip to content

Commit

Permalink
Add migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Nov 3, 2023
1 parent 8ac36d5 commit b63457a
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"""Remove collection unused columns.
Revision ID: 382d7921f500
Revises: 2d72d6876c52
Create Date: 2023-11-03 00:09:10.761425+00:00
"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "382d7921f500"
down_revision = "2d72d6876c52"
branch_labels = None
depends_on = None


def upgrade() -> None:
op.drop_table("collections_libraries")
op.drop_column("collections", "external_integration_id")
op.drop_column("collections", "name")
op.drop_column("collections", "external_account_id")


def downgrade() -> None:
op.add_column(
"collections",
sa.Column(
"external_account_id", sa.VARCHAR(), autoincrement=False, nullable=True
),
)
op.add_column(
"collections",
sa.Column("name", sa.VARCHAR(), autoincrement=False, nullable=True),
)
op.add_column(
"collections",
sa.Column(
"external_integration_id", sa.INTEGER(), autoincrement=False, nullable=True
),
)
op.create_table(
"collections_libraries",
sa.Column("collection_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column("library_id", sa.INTEGER(), autoincrement=False, nullable=True),
sa.UniqueConstraint(
"collection_id",
"library_id",
name="collections_libraries_collection_id_library_id_key",
),
)

0 comments on commit b63457a

Please sign in to comment.