V5.0.0 //

-> Refonte du système de login
-> Récupération du MDP
-> Refonte imports d'horaires + Modale de gestion d'horaires
This commit is contained in:
AdminGit committed 2026-10-01 23:44:09 +02:00
1 parent d89eaaa17f
commit 36b0c00cbc
23 files changed
+5557 -1399

No files matched your search

+73 -37
View File
@@ -257,49 +257,76 @@ CREATE INDEX IF NOT EXISTS "idx_lignes_gares_ligne" ON "public"."lignes_gares" (
CREATE INDEX IF NOT EXISTS "idx_lignes_gares_ordre" ON "public"."lignes_gares" ("ligne_id","ordre");
-- -----------------------------------------------
-- 6.11 horaires
-- 6.11 horaires (Table unique et consolidée)
-- -----------------------------------------------
CREATE TABLE IF NOT EXISTS "public"."horaires" (
"id" uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY,
"numero_train" varchar(50) NOT NULL,
"type_train" varchar(255),
"type_train_id" bigint REFERENCES "public"."types_train"("id") ON DELETE SET NULL,
"gare_depart_id" uuid REFERENCES "public"."gares"("id") ON DELETE SET NULL,
"gare_depart_nom" varchar(255),
"heure_depart" time,
"gare_arrivee_id" uuid REFERENCES "public"."gares"("id") ON DELETE SET NULL,
"gare_arrivee_nom" varchar(255),
"heure_arrivee" time,
"circule_lundi" boolean DEFAULT true,
"circule_mardi" boolean DEFAULT true,
"circule_mercredi" boolean DEFAULT true,
"circule_jeudi" boolean DEFAULT true,
"circule_vendredi" boolean DEFAULT true,
"circule_samedi" boolean DEFAULT true,
"circule_dimanche" boolean DEFAULT true,
"circule_jours_feries" boolean DEFAULT false,
"circule_dimanches_feries" boolean DEFAULT false,
"jours_personnalises" jsonb DEFAULT '[]'::jsonb,
"jours_non_circulation" jsonb DEFAULT '[]'::jsonb,
"materiel_roulant_id" bigint REFERENCES "public"."materiel-roulant"("id") ON DELETE SET NULL,
"ligne_id" uuid REFERENCES "public"."lignes"("id") ON DELETE SET NULL,
"ligne_nom" varchar(255),
"service_annuel_id" uuid REFERENCES "public"."services_annuels"("id") ON DELETE SET NULL,
"service_annuel_nom" varchar(255),
"est_substitution" boolean DEFAULT false,
"motif_substitution" varchar(255),
"gares_desservies" jsonb DEFAULT '[]'::jsonb,
"composition_train" jsonb DEFAULT '[]'::jsonb,
"substitution_disponible" boolean DEFAULT false,
"actif" boolean DEFAULT true,
"region_id" varchar(100),
"created_at" timestamptz DEFAULT now(),
"updated_at" timestamptz DEFAULT now(),
"deleted_at" timestamptz
"id" uuid DEFAULT gen_random_uuid() NOT NULL PRIMARY KEY,
"numero_train" varchar(50) NOT NULL,
"nom_train" varchar(255),
"code_mission" varchar(50),
"sens" varchar(20) DEFAULT 'aller',
"type_train" varchar(100),
"type_train_id" bigint REFERENCES "public"."types_train"("id") ON DELETE SET NULL,
"transporteur" varchar(100) DEFAULT 'SNCF Voyageurs',
"gare_depart_id" uuid REFERENCES "public"."gares"("id") ON DELETE SET NULL,
"gare_depart_nom" varchar(255) NOT NULL,
"heure_depart" time,
"gare_arrivee_id" uuid REFERENCES "public"."gares"("id") ON DELETE SET NULL,
"gare_arrivee_nom" varchar(255) NOT NULL,
"heure_arrivee" time,
"gares_desservies" jsonb NOT NULL DEFAULT '[]'::jsonb,
"attributions_quais" jsonb NOT NULL DEFAULT '{}'::jsonb,
"circule_lundi" boolean DEFAULT true,
"circule_mardi" boolean DEFAULT true,
"circule_mercredi" boolean DEFAULT true,
"circule_jeudi" boolean DEFAULT true,
"circule_vendredi" boolean DEFAULT true,
"circule_samedi" boolean DEFAULT true,
"circule_dimanche" boolean DEFAULT true,
"circule_jours_feries" boolean DEFAULT false,
"circule_dimanches_feries" boolean DEFAULT false,
"date_debut" timestamptz,
"date_fin" timestamptz,
"jours_personnalises" jsonb NOT NULL DEFAULT '[]'::jsonb,
"jours_non_circulation" jsonb NOT NULL DEFAULT '[]'::jsonb,
"calendrier_circulation" jsonb NOT NULL DEFAULT '[]'::jsonb,
"periode_validite" jsonb NOT NULL DEFAULT '{}'::jsonb,
"materiel_roulant_id" bigint REFERENCES "public"."materiel-roulant"("id") ON DELETE SET NULL,
"composition_train" jsonb NOT NULL DEFAULT '[]'::jsonb,
"ligne_id" uuid REFERENCES "public"."lignes"("id") ON DELETE SET NULL,
"ligne_nom" varchar(255),
"region_id" varchar(100),
"region" varchar(255),
"service_annuel_id" uuid REFERENCES "public"."services_annuels"("id") ON DELETE SET NULL,
"service_annuel_nom" varchar(255),
"service_type" varchar(50) DEFAULT 'TER',
"est_substitution" boolean NOT NULL DEFAULT false,
"motif_substitution" varchar(255),
"substitution_disponible" boolean NOT NULL DEFAULT false,
"horaire_id" uuid REFERENCES "public"."horaires"("id") ON DELETE SET NULL,
"substitutions_associees" jsonb NOT NULL DEFAULT '[]'::jsonb,
"sillon_id" text,
"tranche" varchar(50),
"gestionnaire_infrastructure" varchar(100) DEFAULT 'SNCF Réseau',
"vitesse_max_kmh" integer,
"statut" varchar(50) NOT NULL DEFAULT 'a_l_heure',
"retard_minutes" integer NOT NULL DEFAULT 0,
"retard_motif" text,
"informations_voyageurs" text,
"actif" boolean NOT NULL DEFAULT true,
"metadata" jsonb NOT NULL DEFAULT '{}'::jsonb,
"notes" text,
"created_at" timestamptz NOT NULL DEFAULT now(),
"updated_at" timestamptz NOT NULL DEFAULT now(),
"deleted_at" timestamptz
);
-- Index haute performance B-Tree et GIN
CREATE INDEX IF NOT EXISTS "idx_horaires_numero_train" ON "public"."horaires" ("numero_train");
CREATE INDEX IF NOT EXISTS "idx_horaires_gare_depart" ON "public"."horaires" ("gare_depart_id");
CREATE INDEX IF NOT EXISTS "idx_horaires_gare_arrivee" ON "public"."horaires" ("gare_arrivee_id");
CREATE INDEX IF NOT EXISTS "idx_horaires_departs" ON "public"."horaires" ("gare_depart_id", "heure_depart");
CREATE INDEX IF NOT EXISTS "idx_horaires_arrivees" ON "public"."horaires" ("gare_arrivee_id", "heure_arrivee");
CREATE INDEX IF NOT EXISTS "idx_horaires_actif" ON "public"."horaires" ("actif") WHERE deleted_at IS NULL;
CREATE INDEX IF NOT EXISTS "idx_horaires_type_train" ON "public"."horaires" ("type_train_id");
CREATE INDEX IF NOT EXISTS "idx_horaires_materiel" ON "public"."horaires" ("materiel_roulant_id");
@@ -307,6 +334,15 @@ CREATE INDEX IF NOT EXISTS "idx_horaires_ligne" ON "public"."horaires" ("ligne_i
CREATE INDEX IF NOT EXISTS "idx_horaires_service_annuel" ON "public"."horaires" ("service_annuel_id");
CREATE INDEX IF NOT EXISTS "idx_horaires_substitution" ON "public"."horaires" ("est_substitution");
CREATE INDEX IF NOT EXISTS "idx_horaires_region_id" ON "public"."horaires" ("region_id");
CREATE INDEX IF NOT EXISTS "idx_horaires_dates" ON "public"."horaires" ("date_debut", "date_fin");
CREATE INDEX IF NOT EXISTS "idx_horaires_statut" ON "public"."horaires" ("statut");
-- Index GIN JSONB pour recherche et filtrage ultra-rapide sans jointure
CREATE INDEX IF NOT EXISTS "idx_horaires_gares_desservies_gin" ON "public"."horaires" USING gin ("gares_desservies" jsonb_path_ops);
CREATE INDEX IF NOT EXISTS "idx_horaires_attributions_quais_gin" ON "public"."horaires" USING gin ("attributions_quais");
CREATE INDEX IF NOT EXISTS "idx_horaires_calendrier_gin" ON "public"."horaires" USING gin ("calendrier_circulation" jsonb_path_ops);
CREATE INDEX IF NOT EXISTS "idx_horaires_metadata_gin" ON "public"."horaires" USING gin ("metadata");
-- -----------------------------------------------
-- 6.12 horaires_gares_desservies