gmao/migrations/versions/5784fc27cb2a_ajouter_module_matériel_et_entretien.py
root 374e5e5a54
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Ajouter le module matériel et produits d'entretien
2026-08-21 14:13:00 +00:00

33 lines
1.3 KiB
Python

"""Ajouter le module Matériel & Produits d'entretien.
Revision ID: 5784fc27cb2a
Revises: a07b8c9d0e2f
"""
from alembic import op
from app_new.core.models.cleaning import (
ProductCategory, ProductGeneric, CommercialProduct, ProductPackaging,
StockLocation, StockLot, StockLotBalance, StockMovement,
MaterialAssignment, ReusableContainer, ContainerFill, ProductDocument,
RequestProfile, RequestProfileItem, StockInventory, StockInventoryLine,
CleaningForecastConfig,
)
revision = "5784fc27cb2a"
down_revision = "a07b8c9d0e2f"
branch_labels = None
depends_on = None
_TABLES = [
CleaningForecastConfig.__table__, ProductCategory.__table__,
RequestProfile.__table__, ProductGeneric.__table__, CommercialProduct.__table__,
RequestProfileItem.__table__, ProductDocument.__table__, ProductPackaging.__table__,
ReusableContainer.__table__, StockLot.__table__, StockLocation.__table__,
MaterialAssignment.__table__, StockInventory.__table__, StockLotBalance.__table__,
StockMovement.__table__, ContainerFill.__table__, StockInventoryLine.__table__,
]
def upgrade():
bind = op.get_bind()
for table in _TABLES:
table.create(bind=bind, checkfirst=True)
def downgrade():
bind = op.get_bind()
for table in reversed(_TABLES):
table.drop(bind=bind, checkfirst=True)