c68838acf2
CI / lint (pull_request) Successful in 5s
CI / typecheck (pull_request) Failing after 29s
CI / test (pull_request) Failing after 48s
CI / build-and-push (pull_request) Has been skipped
CI / deploy-dev (pull_request) Has been skipped
CI / deploy-uat (pull_request) Has been skipped
- Auto-fix F401 (unused imports) and I001 (unsorted imports) with ruff --fix - Manually fix E501 (line too long) in alembic migrations and src/ models - Run ruff format to ensure consistent formatting Co-Authored-By: Paperclip <noreply@paperclip.ing>
40 lines
940 B
Python
40 lines
940 B
Python
"""Add GIN index on upc_variants and alter column to JSONB.
|
|
|
|
Revision ID: 009_add_gin_index_upc_variants
|
|
Revises: 008_create_domain_tables
|
|
Create Date: 2026-04-14
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
|
|
from alembic import op
|
|
|
|
revision = "009_add_gin_index_upc_variants"
|
|
down_revision = "008_create_domain_tables"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.alter_column(
|
|
"normalized_products",
|
|
"upc_variants",
|
|
type_=sa.dialects.postgresql.JSONB(),
|
|
postgresql_using="upc_variants::jsonb",
|
|
)
|
|
op.create_index(
|
|
"ix_normalized_products_upc_variants_gin",
|
|
"normalized_products",
|
|
["upc_variants"],
|
|
postgresql_using="gin",
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_normalized_products_upc_variants_gin", table_name="normalized_products")
|
|
op.alter_column(
|
|
"normalized_products",
|
|
"upc_variants",
|
|
type_=sa.JSON(),
|
|
)
|