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:
@@ -6,7 +6,6 @@ MODELS = [
|
||||
"shared.models.kv",
|
||||
"shared.models.menu_item",
|
||||
"shared.models.menu_node",
|
||||
"shared.models.container_relation",
|
||||
"blog.models.snippet",
|
||||
"blog.models.tag_group",
|
||||
]
|
||||
@@ -14,7 +13,7 @@ MODELS = [
|
||||
TABLES = frozenset({
|
||||
"posts", "authors", "post_authors", "tags", "post_tags", "post_likes",
|
||||
"snippets", "tag_groups", "tag_group_tags",
|
||||
"menu_items", "menu_nodes", "kv", "container_relations",
|
||||
"menu_items", "menu_nodes", "kv",
|
||||
})
|
||||
|
||||
run_alembic(context.config, MODELS, TABLES)
|
||||
|
||||
40
blog/alembic/versions/0002_drop_container_relations.py
Normal file
40
blog/alembic/versions/0002_drop_container_relations.py
Normal 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"])
|
||||
Reference in New Issue
Block a user