feat: initial shared library extraction
Contains shared infrastructure for all coop services: - shared/ (factory, urls, user_loader, context, internal_api, jinja_setup) - models/ (User, Order, Calendar, Ticket, Product, Ghost CMS) - db/ (SQLAlchemy async session, base) - suma_browser/app/ (csrf, middleware, errors, authz, redis_cacher, payments, filters, utils) - suma_browser/templates/ (shared base layouts, macros, error pages) - static/ (CSS, JS, fonts, images) - alembic/ (database migrations) - config/ (app-config.yaml) - editor/ (Lexical editor Node.js build) - requirements.txt Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
52
alembic/old_versions/20251107_121500_add_labels_stickers.py
Normal file
52
alembic/old_versions/20251107_121500_add_labels_stickers.py
Normal file
@@ -0,0 +1,52 @@
|
||||
"""add product labels and stickers
|
||||
|
||||
Revision ID: 20251107_121500_add_labels_stickers
|
||||
Revises: 20251107_090500_snapshot_to_db
|
||||
Create Date: 2025-11-07T12:15:00.000000
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "20251107_121500_labels_stickers"
|
||||
down_revision = "20251107_090500_snapshot_to_db"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"product_labels",
|
||||
sa.Column("id", sa.Integer(), primary_key=True),
|
||||
sa.Column("product_id", sa.Integer(), sa.ForeignKey("products.id", ondelete="CASCADE"), nullable=False),
|
||||
sa.Column("name", sa.String(length=255), nullable=False),
|
||||
)
|
||||
op.create_index("ix_product_labels_product_id", "product_labels", ["product_id"], unique=False)
|
||||
op.create_index("ix_product_labels_name", "product_labels", ["name"], unique=False)
|
||||
op.create_unique_constraint(
|
||||
"uq_product_labels_product_name", "product_labels", ["product_id", "name"]
|
||||
)
|
||||
|
||||
op.create_table(
|
||||
"product_stickers",
|
||||
sa.Column("id", sa.Integer(), primary_key=True),
|
||||
sa.Column("product_id", sa.Integer(), sa.ForeignKey("products.id", ondelete="CASCADE"), nullable=False),
|
||||
sa.Column("name", sa.String(length=255), nullable=False),
|
||||
)
|
||||
op.create_index("ix_product_stickers_product_id", "product_stickers", ["product_id"], unique=False)
|
||||
op.create_index("ix_product_stickers_name", "product_stickers", ["name"], unique=False)
|
||||
op.create_unique_constraint(
|
||||
"uq_product_stickers_product_name", "product_stickers", ["product_id", "name"]
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_constraint("uq_product_stickers_product_name", "product_stickers", type_="unique")
|
||||
op.drop_index("ix_product_stickers_name", table_name="product_stickers")
|
||||
op.drop_index("ix_product_stickers_product_id", table_name="product_stickers")
|
||||
op.drop_table("product_stickers")
|
||||
|
||||
op.drop_constraint("uq_product_labels_product_name", "product_labels", type_="unique")
|
||||
op.drop_index("ix_product_labels_name", table_name="product_labels")
|
||||
op.drop_index("ix_product_labels_product_id", table_name="product_labels")
|
||||
op.drop_table("product_labels")
|
||||
Reference in New Issue
Block a user