feat(logistique) : migration schéma M5 tickets de pesée (ERP-182) #132
Reference in New Issue
Block a user
Delete Branch "feat/erp-182-migration-m5"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacké sur #131 (ERP-181 scaffolding). Base =
feat/erp-181-logistique-module.Objet
Crée le schéma BDD du module Logistique (M5 — tickets de pesée), migration au namespace racine
DoctrineMigrations(FK cross-module user/client/supplier/site — règle ABSOLUE n°11).Contenu
site.codeVARCHAR(8) — préfixe de numérotation{siteCode}-TP-{NNNN}(RG-5.02) + backfill depuis le code postal + index uniqueuq_site_code.Sitene mappe pas encorecode, donc unNOT NULLcasserait fixtures/tests (INSERT ORM sanscode). Le mapping ORMSite::code+ peuplement (86/17/82) +SET NOT NULLsont portés par le ticket entité (ERP-183, via une 2ᵉ migration). L'index unique est déjà posé (Postgres tolère plusieurs NULL).weighing_ticket_counter/weighbridge_dsd_counter— compteurs par site (numéro RG-5.02 / DSD pont RG-5.04), gérés en DBAL brutFOR UPDATE, jamais mappés en ORM → exclus duschema_filter(sinonschema:updateles droppe en test, cf. précédentaudit_log/idtf) + catalogués dansColumnCommentsCatalog.weighing_ticket— table principale : contrepartie CLIENT/FOURNISSEUR/AUTRE (CHECK 3 branches RG-5.03), immatriculation partagée +plate_free_format, pesées vide/plein en colonnes plates,net_weightdérivé (RG-5.05),deleted_atsoft-delete + 4 colonnes Timestampable/Blamable. Index unique(site_id, number)+ index FK.ON DELETE: site/client/supplier = RESTRICT, created_by/updated_by = SET NULL.Règle n°12
COMMENT ON COLUMN(FR) sur chaque colonne créée — vérifié sur la BDD dev :weighing_ticket25/25, compteurs 2/2,site.code✓.Vérifications
make db-reset+migration-migrate(BDD fraîche) → OKmake test: 6/6 garde-fous Architecture verts (dontColumnsHaveSqlCommentTest), 798 tests vertsmake php-cs-fixer-allow-risky: 0 fichier modifiéNote périmètre
La table
weighing_ticketet la colonnesite.codesont droppées parschema:update --forcesur la base de TEST uniquement d'ici le ticket entité (sans impact : aucun test ne les référence ; dev/prod ne lancent jamaisschema:update).Crée le schéma BDD du module Logistique (M5) au namespace racine DoctrineMigrations (FK cross-module user/client/supplier/site, règle n°11) : - site.code VARCHAR(8) (préfixe de numérotation {siteCode}-TP, RG-5.02) + backfill depuis le code postal + index unique uq_site_code. Colonne NULLABLE à ce ticket (l'entité Site ne mappe pas encore code) ; mapping ORM, peuplement et SET NOT NULL portés par le ticket entité. - weighing_ticket_counter / weighbridge_dsd_counter : compteurs par site (numéro RG-5.02 / DSD pont RG-5.04), gérés en DBAL brut FOR UPDATE, hors ORM → exclus du schema_filter (sinon schema:update les droppe) + catalogués. - weighing_ticket : table principale (contrepartie Client/Fournisseur/Autre avec CHECK 3 branches RG-5.03, immatriculation partagée, pesées vide/plein en colonnes plates, net_weight dérivé, soft-delete + Timestampable/Blamable). Index unique (site_id, number) + index FK. ON DELETE site/client/supplier = RESTRICT, created_by/updated_by = SET NULL. COMMENT ON COLUMN sur chaque colonne créée (règle n°12). make test + ColumnsHaveSqlCommentTest verts, db-reset OK.