All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m1s
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
1.6 KiB
Python
41 lines
1.6 KiB
Python
"""Drop container_relations table — moved to cart service.
|
|
|
|
Revision ID: blog_0002
|
|
Revises: blog_0001
|
|
Create Date: 2026-02-26
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "blog_0002"
|
|
down_revision = "blog_0001"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.drop_index("ix_container_relations_child", table_name="container_relations")
|
|
op.drop_index("ix_container_relations_parent", table_name="container_relations")
|
|
op.drop_table("container_relations")
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.create_table(
|
|
"container_relations",
|
|
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
|
|
sa.Column("parent_type", sa.String(32), nullable=False),
|
|
sa.Column("parent_id", sa.Integer(), nullable=False),
|
|
sa.Column("child_type", sa.String(32), nullable=False),
|
|
sa.Column("child_id", sa.Integer(), nullable=False),
|
|
sa.Column("sort_order", sa.Integer(), nullable=False),
|
|
sa.Column("label", sa.String(255), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.text("now()")),
|
|
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
sa.UniqueConstraint("parent_type", "parent_id", "child_type", "child_id",
|
|
name="uq_container_relations_parent_child"),
|
|
)
|
|
op.create_index("ix_container_relations_parent", "container_relations", ["parent_type", "parent_id"])
|
|
op.create_index("ix_container_relations_child", "container_relations", ["child_type", "child_id"])
|