chore: import WonderQ project
This commit is contained in:
commit
f5a9e4403a
452 files changed
+34173
No files matched your search
@@ -0,0 +1,54 @@
|
||||
"""Add route section configuration.
|
||||
|
||||
Revision ID: 0004_route_sections
|
||||
Revises: 0003_campaign_display_fields
|
||||
Create Date: 2026-07-02
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy import inspect
|
||||
|
||||
|
||||
revision = "0004_route_sections"
|
||||
down_revision = "0003_campaign_display_fields"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
existing_tables = set(inspect(bind).get_table_names())
|
||||
|
||||
if "RouteSection" not in existing_tables:
|
||||
op.create_table(
|
||||
"RouteSection",
|
||||
sa.Column("id", sa.String(), nullable=False),
|
||||
sa.Column("title", sa.String(), nullable=False),
|
||||
sa.Column("subtitle", sa.Text(), nullable=True),
|
||||
sa.Column("sortOrder", sa.Integer(), nullable=False, server_default="0"),
|
||||
sa.Column("isActive", sa.Boolean(), nullable=False, server_default=sa.true()),
|
||||
sa.Column("createdAt", sa.DateTime(), nullable=False),
|
||||
sa.Column("updatedAt", sa.DateTime(), nullable=False),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
|
||||
if "RouteSectionProduct" not in existing_tables:
|
||||
op.create_table(
|
||||
"RouteSectionProduct",
|
||||
sa.Column("sectionId", sa.String(), nullable=False),
|
||||
sa.Column("productId", sa.String(), nullable=False),
|
||||
sa.Column("sortOrder", sa.Integer(), nullable=False, server_default="0"),
|
||||
sa.ForeignKeyConstraint(["productId"], ["Product.id"], ondelete="CASCADE"),
|
||||
sa.ForeignKeyConstraint(["sectionId"], ["RouteSection.id"], ondelete="CASCADE"),
|
||||
sa.PrimaryKeyConstraint("sectionId", "productId"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
bind = op.get_bind()
|
||||
existing_tables = set(inspect(bind).get_table_names())
|
||||
if "RouteSectionProduct" in existing_tables:
|
||||
op.drop_table("RouteSectionProduct")
|
||||
if "RouteSection" in existing_tables:
|
||||
op.drop_table("RouteSection")
|
||||
Reference in new issue
Block a user