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>
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
revision = '20251107_add_missing_indexes'
|
|
down_revision = '1a1f1f1fc71c' # Adjust if needed to match your current head
|
|
depends_on = None
|
|
branch_labels = None
|
|
|
|
def upgrade() -> None:
|
|
# Index for sorting by price
|
|
op.create_index("ix_products_regular_price", "products", ["regular_price"])
|
|
|
|
# Index for filtering/aggregating by brand
|
|
op.create_index("ix_products_brand", "products", ["brand"])
|
|
|
|
# Index for product_likes.product_id (if not already covered by FK)
|
|
op.create_index("ix_product_likes_product_id", "product_likes", ["product_id"])
|
|
|
|
# Composite index on listing_items (may be partially redundant with existing constraints)
|
|
op.create_index("ix_listing_items_listing_slug", "listing_items", ["listing_id", "slug"])
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_listing_items_listing_slug", table_name="listing_items")
|
|
op.drop_index("ix_product_likes_product_id", table_name="product_likes")
|
|
op.drop_index("ix_products_brand", table_name="products")
|
|
op.drop_index("ix_products_regular_price", table_name="products")
|