"""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')