Files
home_hub/backend/alembic/versions/003_shopping_enrichments.py
T
gilles 85093f1b99 feat(shopping): refonte UX + CRUD catalogue/boutiques + champs enrichis
- UX : vue par défaut = liste en cours, landing si pas de liste (+ vert +
  baguette magique), suppression des vues "listes" et "mode magasin" séparés
- Articles cochés barrés et déplacés en bas, tri alphabétique par section
- Nom de liste auto avec numéro de semaine ISO (S21 2026)
- Wake lock activé dès qu'une liste est ouverte
- CRUD boutiques : POST/PATCH/DELETE /stores + modal Boutiques
- CRUD articles : POST/PATCH/DELETE /products + modal Catalogue
- Champs enrichis produits : description, prix, quantité/unité, boutique défaut
- Champs enrichis boutiques : url, store_type (alimentaire, bricolage…)
- Migration 003 : nouveaux champs en base

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 16:21:45 +02:00

39 lines
1.7 KiB
Python

"""shopping enrichments — champs enrichis produits et boutiques"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import UUID
revision = '003'
down_revision = '002'
branch_labels = None
depends_on = None
def upgrade() -> None:
# Nouveaux champs produits
op.add_column('products', sa.Column('description', sa.Text(), nullable=True), schema='shopping')
op.add_column('products', sa.Column('price', sa.Numeric(8, 2), nullable=True), schema='shopping')
op.add_column('products', sa.Column('quantity_per_unit', sa.Numeric(8, 3), nullable=True), schema='shopping')
op.add_column('products', sa.Column('default_store_id', UUID(as_uuid=True), nullable=True), schema='shopping')
op.create_foreign_key(
'fk_products_default_store',
'products', 'stores',
['default_store_id'], ['id'],
source_schema='shopping', referent_schema='shopping',
ondelete='SET NULL',
)
# Nouveaux champs boutiques
op.add_column('stores', sa.Column('url', sa.Text(), nullable=True), schema='shopping')
op.add_column('stores', sa.Column('store_type', sa.String(50), nullable=True), schema='shopping')
def downgrade() -> None:
op.drop_constraint('fk_products_default_store', 'products', schema='shopping', type_='foreignkey')
op.drop_column('products', 'description', schema='shopping')
op.drop_column('products', 'price', schema='shopping')
op.drop_column('products', 'quantity_per_unit', schema='shopping')
op.drop_column('products', 'default_store_id', schema='shopping')
op.drop_column('stores', 'url', schema='shopping')
op.drop_column('stores', 'store_type', schema='shopping')