fix: apply plural table name renames to all migrations V2-V16

Same rename applied to V1 must propagate to V2-V16 which referenced
old singular table names (compte_comptable, suggestion, etc.)
This commit is contained in:
dahoud
2026-04-08 17:32:48 +00:00
parent e6627ab45d
commit 139642c4cd
2 changed files with 54 additions and 54 deletions

View File

@@ -19,21 +19,21 @@
-- 0. Renommer les tables singulières → plurielles (alignement entités JPA)
-- -----------------------------------------------------------------------------
-- formule_abonnement → formules_abonnement (FormuleAbonnement entity @Table)
-- formules_abonnement → formules_abonnement (FormuleAbonnement entity @Table)
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = 'formule_abonnement')
IF EXISTS (SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = 'formules_abonnement')
AND NOT EXISTS (SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = 'formules_abonnement') THEN
ALTER TABLE formule_abonnement RENAME TO formules_abonnement;
ALTER TABLE formules_abonnement RENAME TO formules_abonnement;
END IF;
END $$;
-- souscription_organisation → souscriptions_organisation (SouscriptionOrganisation entity @Table)
-- souscriptions_organisation → souscriptions_organisation (SouscriptionOrganisation entity @Table)
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = 'souscription_organisation')
IF EXISTS (SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = 'souscriptions_organisation')
AND NOT EXISTS (SELECT 1 FROM pg_tables WHERE schemaname = 'public' AND tablename = 'souscriptions_organisation') THEN
ALTER TABLE souscription_organisation RENAME TO souscriptions_organisation;
ALTER TABLE souscriptions_organisation RENAME TO souscriptions_organisation;
END IF;
END $$;