feat(#102): BDD nir_chiffre NOT NULL + migration pour bases existantes
Made-with: Cursor
This commit is contained in:
parent
38c003ef6f
commit
a9c6b9e15b
@ -80,7 +80,7 @@ CREATE INDEX idx_utilisateurs_token_creation_mdp
|
||||
CREATE TABLE assistantes_maternelles (
|
||||
id_utilisateur UUID PRIMARY KEY REFERENCES utilisateurs(id) ON DELETE CASCADE,
|
||||
numero_agrement VARCHAR(50),
|
||||
nir_chiffre CHAR(15),
|
||||
nir_chiffre CHAR(15) NOT NULL,
|
||||
nb_max_enfants INT,
|
||||
biographie TEXT,
|
||||
disponible BOOLEAN DEFAULT true,
|
||||
|
||||
16
database/migrations/2026_nir_chiffre_not_null.sql
Normal file
16
database/migrations/2026_nir_chiffre_not_null.sql
Normal file
@ -0,0 +1,16 @@
|
||||
-- Migration : rendre nir_chiffre NOT NULL (ticket #102)
|
||||
-- À exécuter sur les bases existantes avant déploiement du schéma avec nir_chiffre NOT NULL.
|
||||
-- Les lignes sans NIR reçoivent un NIR de test valide (format + clé) pour satisfaire la contrainte.
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Renseigner un NIR de test valide pour toute ligne où nir_chiffre est NULL
|
||||
UPDATE assistantes_maternelles
|
||||
SET nir_chiffre = '275119900100102'
|
||||
WHERE nir_chiffre IS NULL;
|
||||
|
||||
-- Appliquer la contrainte NOT NULL
|
||||
ALTER TABLE assistantes_maternelles
|
||||
ALTER COLUMN nir_chiffre SET NOT NULL;
|
||||
|
||||
COMMIT;
|
||||
Loading…
x
Reference in New Issue
Block a user