feat(#119): dossier famille = 1 par famille, N enfants; retrait repas/type_contrat/budget; adresse dans API parents

Made-with: Cursor
This commit is contained in:
2026-03-18 01:52:28 +01:00
parent 5465117238
commit 1772744c81
6 changed files with 138 additions and 15 deletions
@@ -0,0 +1,27 @@
-- Un dossier = une famille, N enfants. Ticket #119 évolution.
-- Table: un enregistrement par famille (lien via numero_dossier / id_parent).
CREATE TABLE IF NOT EXISTS dossier_famille (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
numero_dossier VARCHAR(20) NOT NULL,
id_parent UUID NOT NULL REFERENCES parents(id_utilisateur) ON DELETE CASCADE,
presentation TEXT,
type_contrat VARCHAR(50),
repas BOOLEAN NOT NULL DEFAULT false,
budget NUMERIC(10,2),
planning_souhaite JSONB,
statut statut_dossier_type NOT NULL DEFAULT 'envoye',
cree_le TIMESTAMPTZ NOT NULL DEFAULT now(),
modifie_le TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_dossier_famille_numero ON dossier_famille(numero_dossier);
CREATE INDEX IF NOT EXISTS idx_dossier_famille_id_parent ON dossier_famille(id_parent);
-- Enfants concernés par ce dossier famille (N par dossier).
CREATE TABLE IF NOT EXISTS dossier_famille_enfants (
id_dossier_famille UUID NOT NULL REFERENCES dossier_famille(id) ON DELETE CASCADE,
id_enfant UUID NOT NULL REFERENCES enfants(id) ON DELETE CASCADE,
PRIMARY KEY (id_dossier_famille, id_enfant)
);
CREATE INDEX IF NOT EXISTS idx_dossier_famille_enfants_enfant ON dossier_famille_enfants(id_enfant);
@@ -0,0 +1,5 @@
-- Dossier famille = inscription uniquement, pas les données de dossier de garde (repas, type_contrat, budget, etc.)
ALTER TABLE dossier_famille DROP COLUMN IF EXISTS repas;
ALTER TABLE dossier_famille DROP COLUMN IF EXISTS type_contrat;
ALTER TABLE dossier_famille DROP COLUMN IF EXISTS budget;
ALTER TABLE dossier_famille DROP COLUMN IF EXISTS planning_souhaite;