feat(products): compute price tiers from objective price/use
This commit is contained in:
parent
c5ea38880c
commit
83ba4cc5c0
13 changed files with 664 additions and 48 deletions
|
|
@ -0,0 +1,45 @@
|
|||
"""replace_price_tier_with_objective_price_fields
|
||||
|
||||
Revision ID: 7c91e4b2af38
|
||||
Revises: e4f5a6b7c8d9
|
||||
Create Date: 2026-03-04 00:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision: str = "7c91e4b2af38"
|
||||
down_revision: Union[str, None] = "e4f5a6b7c8d9"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column("products", sa.Column("price_amount", sa.Float(), nullable=True))
|
||||
op.add_column(
|
||||
"products", sa.Column("price_currency", sa.String(length=3), nullable=True)
|
||||
)
|
||||
op.drop_index(op.f("ix_products_price_tier"), table_name="products")
|
||||
op.drop_column("products", "price_tier")
|
||||
op.execute("DROP TYPE IF EXISTS pricetier")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.execute("CREATE TYPE pricetier AS ENUM ('BUDGET', 'MID', 'PREMIUM', 'LUXURY')")
|
||||
op.add_column(
|
||||
"products",
|
||||
sa.Column(
|
||||
"price_tier",
|
||||
sa.Enum("BUDGET", "MID", "PREMIUM", "LUXURY", name="pricetier"),
|
||||
nullable=True,
|
||||
),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_products_price_tier"), "products", ["price_tier"], unique=False
|
||||
)
|
||||
op.drop_column("products", "price_currency")
|
||||
op.drop_column("products", "price_amount")
|
||||
Loading…
Add table
Add a link
Reference in a new issue