Some checks failed
Build and Deploy / build-and-deploy (push) Has been cancelled
Phase 1 - Relations service (internal): owns ContainerRelation, exposes get-children data + attach/detach-child actions. Retargeted events, blog, market callers from cart to relations. Phase 2 - Likes service (internal): unified Like model replaces ProductLike and PostLike with generic target_type/target_slug/target_id. Exposes is-liked, liked-slugs, liked-ids data + toggle action. Phase 3 - PageConfig → blog: moved ownership to blog with direct DB queries, removed proxy endpoints from cart. Phase 4 - Orders service (public): owns Order/OrderItem + SumUp checkout flow. Cart checkout now delegates to orders via create-order action. Webhook/return routes and reconciliation moved to orders. Phase 5 - Infrastructure: docker-compose, deploy.sh, Dockerfiles updated for all 3 new services. Added orders_url helper and factory model imports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
"""Initial relations tables
|
|
|
|
Revision ID: relations_0001
|
|
Revises: None
|
|
Create Date: 2026-02-27
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
|
|
revision = "relations_0001"
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def _table_exists(conn, name):
|
|
result = conn.execute(sa.text(
|
|
"SELECT 1 FROM information_schema.tables WHERE table_schema='public' AND table_name=:t"
|
|
), {"t": name})
|
|
return result.scalar() is not None
|
|
|
|
|
|
def upgrade():
|
|
if _table_exists(op.get_bind(), "container_relations"):
|
|
return
|
|
|
|
op.create_table(
|
|
"container_relations",
|
|
sa.Column("id", sa.Integer, primary_key=True, autoincrement=True),
|
|
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, server_default="0"),
|
|
sa.Column("label", sa.String(255), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()),
|
|
sa.Column("deleted_at", sa.DateTime(timezone=True), nullable=True),
|
|
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"])
|
|
|
|
|
|
def downgrade():
|
|
op.drop_table("container_relations")
|