Drop container_relations from blog DB — now lives in cart

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-26 17:51:53 +00:00
parent 1f3d98ecc1
commit e45edbf362
2 changed files with 41 additions and 2 deletions

View File

@@ -0,0 +1,40 @@
"""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"])