feat(subscriptions): migrate subscription management to merchant level and seed tiers
Move subscription create/edit from store detail (broken endpoint) to merchant detail page with proper modal UI. Seed 4 subscription tiers (Essential, Professional, Business, Enterprise) in init_production.py. Also includes cross-module dependency declarations, store domain platform_id migration, platform context middleware, CMS route fixes, and migration backups. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
67
alembic/versions_backup/a2064e1dfcd4_add_cart_items_table.py
Normal file
67
alembic/versions_backup/a2064e1dfcd4_add_cart_items_table.py
Normal file
@@ -0,0 +1,67 @@
|
||||
"""add cart_items table
|
||||
|
||||
Revision ID: a2064e1dfcd4
|
||||
Revises: f68d8da5315a
|
||||
Create Date: 2025-11-23 19:52:40.509538
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "a2064e1dfcd4"
|
||||
down_revision: Union[str, None] = "f68d8da5315a"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Create cart_items table
|
||||
op.create_table(
|
||||
"cart_items",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
sa.Column("vendor_id", sa.Integer(), nullable=False),
|
||||
sa.Column("product_id", sa.Integer(), nullable=False),
|
||||
sa.Column("session_id", sa.String(length=255), nullable=False),
|
||||
sa.Column("quantity", sa.Integer(), nullable=False),
|
||||
sa.Column("price_at_add", sa.Float(), nullable=False),
|
||||
sa.Column("created_at", sa.DateTime(), nullable=True),
|
||||
sa.Column("updated_at", sa.DateTime(), nullable=True),
|
||||
sa.ForeignKeyConstraint(
|
||||
["product_id"],
|
||||
["products.id"],
|
||||
),
|
||||
sa.ForeignKeyConstraint(
|
||||
["vendor_id"],
|
||||
["vendors.id"],
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
sa.UniqueConstraint(
|
||||
"vendor_id", "session_id", "product_id", name="uq_cart_item"
|
||||
),
|
||||
)
|
||||
|
||||
# Create indexes
|
||||
op.create_index(
|
||||
"idx_cart_session", "cart_items", ["vendor_id", "session_id"], unique=False
|
||||
)
|
||||
op.create_index("idx_cart_created", "cart_items", ["created_at"], unique=False)
|
||||
op.create_index(op.f("ix_cart_items_id"), "cart_items", ["id"], unique=False)
|
||||
op.create_index(
|
||||
op.f("ix_cart_items_session_id"), "cart_items", ["session_id"], unique=False
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# Drop indexes
|
||||
op.drop_index(op.f("ix_cart_items_session_id"), table_name="cart_items")
|
||||
op.drop_index(op.f("ix_cart_items_id"), table_name="cart_items")
|
||||
op.drop_index("idx_cart_created", table_name="cart_items")
|
||||
op.drop_index("idx_cart_session", table_name="cart_items")
|
||||
|
||||
# Drop table
|
||||
op.drop_table("cart_items")
|
||||
Reference in New Issue
Block a user