release: squash merge develop → master
Quotidien / Epic C : feed bulles parent (#173), module Cartes (#194/#195), evenements_agenda (#205), couples garde AM (#169–#171), API absences (#172). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+29
-16
@@ -35,13 +35,13 @@ DO $$ BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'statut_avenant_type') THEN
|
||||
CREATE TYPE statut_avenant_type AS ENUM ('propose', 'accepte', 'refuse');
|
||||
END IF;
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'type_absence_garde_type') THEN
|
||||
CREATE TYPE type_absence_garde_type AS ENUM (
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'type_evenement_agenda_type') THEN
|
||||
CREATE TYPE type_evenement_agenda_type AS ENUM (
|
||||
'absence_enfant', 'conge_am', 'arret_maladie_am'
|
||||
);
|
||||
END IF;
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'statut_absence_garde_type') THEN
|
||||
CREATE TYPE statut_absence_garde_type AS ENUM (
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'statut_evenement_agenda_type') THEN
|
||||
CREATE TYPE statut_evenement_agenda_type AS ENUM (
|
||||
'en_attente', 'accepte', 'refuse'
|
||||
);
|
||||
END IF;
|
||||
@@ -143,7 +143,10 @@ CREATE TABLE assistantes_maternelles (
|
||||
annee_experience SMALLINT,
|
||||
specialite VARCHAR(100),
|
||||
place_disponible INT,
|
||||
numero_dossier VARCHAR(20)
|
||||
numero_dossier VARCHAR(20),
|
||||
-- Préférence couple de garde actif (TdB quotidien AM) — ticket #171
|
||||
-- FK ajoutée après création de enfants_assistantes_maternelles (voir ALTER plus bas)
|
||||
id_placement_garde_courant UUID
|
||||
);
|
||||
|
||||
CREATE INDEX idx_assistantes_maternelles_numero_dossier
|
||||
@@ -221,6 +224,16 @@ CREATE INDEX idx_parents_placement_garde_courant
|
||||
ON parents(id_placement_garde_courant)
|
||||
WHERE id_placement_garde_courant IS NOT NULL;
|
||||
|
||||
-- FK couple courant AM → placement (#171)
|
||||
ALTER TABLE assistantes_maternelles
|
||||
ADD CONSTRAINT fk_am_placement_garde_courant
|
||||
FOREIGN KEY (id_placement_garde_courant)
|
||||
REFERENCES enfants_assistantes_maternelles(id) ON DELETE SET NULL;
|
||||
|
||||
CREATE INDEX idx_am_placement_garde_courant
|
||||
ON assistantes_maternelles(id_placement_garde_courant)
|
||||
WHERE id_placement_garde_courant IS NOT NULL;
|
||||
|
||||
-- ==========================================================
|
||||
-- Table : dossier_famille (inscription parent — ticket #119)
|
||||
-- ==========================================================
|
||||
@@ -309,32 +322,32 @@ CREATE TABLE avenants_contrats (
|
||||
);
|
||||
|
||||
-- ==========================================================
|
||||
-- Table : absences_garde (vérité métier absences/congés/arrêt)
|
||||
-- Table : evenements_agenda (vérité métier agenda (absences/congés/arrêt + futurs types))
|
||||
-- 1 ligne = 1 période ; rattachement = placement AM↔enfant (#193)
|
||||
-- ==========================================================
|
||||
CREATE TABLE absences_garde (
|
||||
CREATE TABLE evenements_agenda (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
id_placement UUID NOT NULL
|
||||
REFERENCES enfants_assistantes_maternelles(id) ON DELETE CASCADE,
|
||||
type type_absence_garde_type NOT NULL,
|
||||
type type_evenement_agenda_type NOT NULL,
|
||||
date_debut DATE NOT NULL,
|
||||
date_fin DATE NOT NULL,
|
||||
statut statut_absence_garde_type NOT NULL DEFAULT 'en_attente',
|
||||
statut statut_evenement_agenda_type NOT NULL DEFAULT 'en_attente',
|
||||
expire_at TIMESTAMPTZ NOT NULL,
|
||||
cree_par UUID REFERENCES utilisateurs(id) ON DELETE SET NULL,
|
||||
id_card_instance UUID,
|
||||
motif TEXT,
|
||||
cree_le TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
modifie_le TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
CONSTRAINT chk_absences_garde_dates CHECK (date_fin >= date_debut)
|
||||
CONSTRAINT chk_evenements_agenda_dates CHECK (date_fin >= date_debut)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_absences_garde_placement_dates
|
||||
ON absences_garde (id_placement, date_debut, date_fin);
|
||||
CREATE INDEX idx_absences_garde_placement_type_statut
|
||||
ON absences_garde (id_placement, type, statut);
|
||||
CREATE INDEX idx_absences_garde_expire_at
|
||||
ON absences_garde (expire_at)
|
||||
CREATE INDEX idx_evenements_agenda_placement_dates
|
||||
ON evenements_agenda (id_placement, date_debut, date_fin);
|
||||
CREATE INDEX idx_evenements_agenda_placement_type_statut
|
||||
ON evenements_agenda (id_placement, type, statut);
|
||||
CREATE INDEX idx_evenements_agenda_expire_at
|
||||
ON evenements_agenda (expire_at)
|
||||
WHERE statut IN ('en_attente', 'refuse');
|
||||
|
||||
-- ==========================================================
|
||||
|
||||
Reference in New Issue
Block a user