ajout automatique du server + des données
This commit is contained in:
parent
228e46c59d
commit
4d402bb7cc
85
README.md
85
README.md
@ -1,81 +1,80 @@
|
||||
|
||||
|
||||
# PtitsPas Ynov - Base de Données
|
||||
|
||||
Ce projet contient uniquement la **base de données** pour l'application PtitsPas.
|
||||
Ce projet contient la **base de données** pour l'application PtitsPas, avec scripts de migration, import de données, documentation et configuration Docker.
|
||||
|
||||
---
|
||||
|
||||
## Prérequis
|
||||
|
||||
- Docker desktop installé et à jour
|
||||
- Docker Compose installé
|
||||
- Docker Desktop (https://www.docker.com/products/docker-desktop/)
|
||||
- Docker Compose
|
||||
|
||||
```
|
||||
https://www.docker.com/products/docker-desktop/
|
||||
```
|
||||
---
|
||||
|
||||
## Structure du projet
|
||||
|
||||
- `migrations/` : scripts SQL pour la création et l'import de la base
|
||||
- `bdd/data_test/` : fichiers CSV pour l'import de données de test
|
||||
- `docs/` : documentation métier et technique
|
||||
- `seed/` : scripts de seed
|
||||
- `tests/` : tests SQL
|
||||
- `docker-compose.dev.yml` : configuration Docker pour le développement
|
||||
|
||||
---
|
||||
|
||||
## Lancer la base de données en local
|
||||
|
||||
Dans le terminal, depuis le dossier du projet, exécute :
|
||||
Dans le terminal, depuis le dossier du projet :
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.dev.yml up -d
|
||||
````
|
||||
```
|
||||
|
||||
Et pour arreter le container
|
||||
Pour arrêter et supprimer les volumes :
|
||||
|
||||
```bash
|
||||
docker compose -f docker-compose.dev.yml down -v
|
||||
````
|
||||
|
||||
|
||||
---
|
||||
## Accéder à pgAdmin4 via internet
|
||||
|
||||
Ouvre ton navigateur et va sur :
|
||||
|
||||
```
|
||||
https://ynov.ptits-pas.fr/pgadmin/login?next=/pgadmin/browser/
|
||||
```
|
||||
|
||||
### Connexion à pgAdmin4
|
||||
|
||||
* **Email** : `admin@ptits-pas.fr`
|
||||
* **Mot de passe** : `admin123`
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Accéder à pgAdmin4 via Docker
|
||||
## Importation automatique des données de test
|
||||
|
||||
Ouvre ton navigateur et va sur :
|
||||
Les données de test (CSV) sont automatiquement importées dans la base au démarrage du conteneur Docker grâce aux scripts présents dans le dossier `migrations/`.
|
||||
|
||||
Il n'est pas nécessaire de lancer manuellement le script d'import.
|
||||
|
||||
---
|
||||
|
||||
## Accéder à pgAdmin4
|
||||
|
||||
### Via Docker (local)
|
||||
|
||||
Ouvre ton navigateur sur :
|
||||
|
||||
```
|
||||
http://localhost:8081
|
||||
```
|
||||
|
||||
### Connexion à pgAdmin4
|
||||
**Email** : `admin@ptits-pas.fr`
|
||||
**Mot de passe** : `admin123`
|
||||
|
||||
* **Email** : `admin@ptits-pas.fr`
|
||||
* **Mot de passe** : `admin123`
|
||||
**Mot de passse pour se connecter au server local** : `admin123`
|
||||
|
||||
|
||||
## Conseils et bonnes pratiques
|
||||
|
||||
- Vérifie la cohérence des identifiants dans les CSV avant import
|
||||
- Pour modifier la structure, utilise les scripts de migration dans `migrations/`
|
||||
- Pour ajouter des scripts d'automatisation, crée un dossier `scripts/`
|
||||
- Documente les étapes spécifiques dans le README ou dans `docs/`
|
||||
|
||||
---
|
||||
|
||||
### Ajouter le serveur PostgreSQL
|
||||
## Contact
|
||||
|
||||
1. Clique sur **Add New Server** (ou **Register Server**)
|
||||
2. Onglet **General** :
|
||||
|
||||
* **Name** : `Postgres Docker`
|
||||
3. Onglet **Connection** :
|
||||
|
||||
* **Host name/address** : `postgres_bdd`
|
||||
* **Port** : `5432` (ou `5433` si mappé dans Docker Compose)
|
||||
* **Username** : `admin`
|
||||
* **Password** : `admin123`
|
||||
4. Clique sur **Save**
|
||||
|
||||
---
|
||||
Pour toute question ou contribution, consulte la documentation ou contacte l'équipe PtitsPas.
|
||||
|
||||
|
||||
3
bdd/data_test/assistantes_maternelles.csv
Normal file
3
bdd/data_test/assistantes_maternelles.csv
Normal file
@ -0,0 +1,3 @@
|
||||
"id_utilisateur","numero_agrement","nir_chiffre","nb_max_enfants","biographie","disponible","ville_residence","date_agrement","annee_experience","specialite","place_disponible"
|
||||
"a1f3d5c7-8b9a-4e2f-9c1d-3b2a4f6e7d8c","AGR5678",,3,"Agrément 3 enfants - Spécialité 1-3 ans - 1 place disponible",True,,"2010-09-01",14,"1-3 ans",1
|
||||
"d9c2e3f4-5b6a-4c3d-9f1a-2e7b3c5d8a1f","AGR1234",,4,"Agrément 4 enfants - Spécialité bébés 0-18 mois - 2 places disponibles",True,,"2005-06-15",18,"Bébés 0-18 mois",2
|
||||
|
2
bdd/data_test/contrats.csv
Normal file
2
bdd/data_test/contrats.csv
Normal file
@ -0,0 +1,2 @@
|
||||
"id","id_dossier","planning","tarif_horaire","indemnites_repas","date_debut","statut","signe_parent","signe_am","finalise_le","cree_le","modifie_le"
|
||||
"f09c6ffa-4627-4aa8-b20b-829c2c828f0d","bb9c30a0-60b4-4832-9947-8a7d2366673d","{""jours"": [""Lundi"", ""Mardi"", ""Mercredi""]}","10.50","4.50","2024-09-01","brouillon",True,False,,"2025-09-09 11:05:47.933418+00","2025-09-09 11:05:47.933418+00"
|
||||
|
2
bdd/data_test/dossiers.csv
Normal file
2
bdd/data_test/dossiers.csv
Normal file
@ -0,0 +1,2 @@
|
||||
"id","id_parent","id_enfant","presentation","type_contrat","repas","budget","planning_souhaite","statut","cree_le","modifie_le"
|
||||
"bb9c30a0-60b4-4832-9947-8a7d2366673d","f1d3c5b7-8a9e-4f2d-9c1b-3e7a5d8c2f1b","5e8574b7-63e6-4d48-9af3-8d3bf7a6a6cf","Contrat test pour garde à temps plein","temps_plein",False,"1200.00",,"envoye","2025-09-09 10:58:28.718654+00","2025-09-09 10:58:28.718654+00"
|
||||
|
10
bdd/data_test/enfants.csv
Normal file
10
bdd/data_test/enfants.csv
Normal file
@ -0,0 +1,10 @@
|
||||
"id","statut","prenom","nom","genre","date_naissance","date_prevue_naissance","photo_url","consentement_photo","date_consentement_photo","est_multiple"
|
||||
"5e8574b7-63e6-4d48-9af3-8d3bf7a6a6cf","actif","Emma","Dupont","F","2020-06-01",,,False,,False
|
||||
"a5c3268e-07eb-41a4-9f6c-2f9f16f37c3d","actif",,,,"2020-01-01","2025-01-01",,False,,False
|
||||
"e1a2b3c4-d5e6-4f7a-8b9c-1d2e3f4a5b6c","actif","Emma","Martin",,"2023-02-15",,,False,,False
|
||||
"e2b3c4d5-e6f7-4a8b-9c1d-2e3f4a5b6c7d","actif","Noah","Martin",,"2023-02-15",,,False,,False
|
||||
"e3c4d5e6-f7a8-4b9c-1d2e-3f4a5b6c7d8e","actif","Léa","Martin",,"2023-02-15",,,False,,False
|
||||
"e4d5e6f7-a8b9-4c1d-2e3f-4a5b6c7d8e9f","actif","Chloé","Rousseau",,"2022-04-20",,,False,,False
|
||||
"e5e6f7a8-b9c1-4d2e-3f4a-5b6c7d8e9f1a","actif","Hugo","Rousseau",,"2024-03-10",,,False,,False
|
||||
"e6f7a8b9-c1d2-4e3f-5a6b-7c8d9e0f1a2b","actif","Maxime","Lecomte",,"2023-04-15",,,False,,False
|
||||
"edd19cd1-bb67-4f14-8a37-c66b75c94537","scolarise","Lucas","Durand","H","2018-09-15",,,False,,False
|
||||
|
9
bdd/data_test/enfants_parents.csv
Normal file
9
bdd/data_test/enfants_parents.csv
Normal file
@ -0,0 +1,9 @@
|
||||
"id_parent","id_enfant"
|
||||
"b6c4d2e3-5f7a-4b8c-9d1e-2a3c5f7b8d9e","e4d5e6f7-a8b9-4c1d-2e3f-4a5b6c7d8e9f"
|
||||
"b6c4d2e3-5f7a-4b8c-9d1e-2a3c5f7b8d9e","e5e6f7a8-b9c1-4d2e-3f4a-5b6c7d8e9f1a"
|
||||
"c4e2d1f5-6b7a-4c3d-8f2a-1e9c3b5a7d6f","e1a2b3c4-d5e6-4f7a-8b9c-1d2e3f4a5b6c"
|
||||
"c4e2d1f5-6b7a-4c3d-8f2a-1e9c3b5a7d6f","e2b3c4d5-e6f7-4a8b-9c1d-2e3f4a5b6c7d"
|
||||
"c4e2d1f5-6b7a-4c3d-8f2a-1e9c3b5a7d6f","e3c4d5e6-f7a8-4b9c-1d2e-3f4a5b6c7d8e"
|
||||
"d3e5f7a9-1c2b-4d6e-8f3a-2b4c6d8e9f1a","e6f7a8b9-c1d2-4e3f-5a6b-7c8d9e0f1a2b"
|
||||
"f1d3c5b7-8a9e-4f2d-9c1b-3e7a5d8c2f1b","e4d5e6f7-a8b9-4c1d-2e3f-4a5b6c7d8e9f"
|
||||
"f1d3c5b7-8a9e-4f2d-9c1b-3e7a5d8c2f1b","e5e6f7a8-b9c1-4d2e-3f4a-5b6c7d8e9f1a"
|
||||
|
2
bdd/data_test/evenements.csv
Normal file
2
bdd/data_test/evenements.csv
Normal file
@ -0,0 +1,2 @@
|
||||
"id","type","id_enfant","id_am","id_parent","cree_par","date_debut","date_fin","commentaires","statut","delai_grace","urgent","cree_le","modifie_le"
|
||||
"9f09425c-a374-4c9f-b3b1-be7258b60cd3","absence_enfant","5e8574b7-63e6-4d48-9af3-8d3bf7a6a6cf","62de8e71-8082-4383-a3a2-4277bdd07516",,"bbcae75c-0e60-4b84-b281-079dba23b44e","2024-11-10 00:00:00+00","2024-11-11 00:00:00+00","Enfant malade","propose",,True,"2025-09-02 12:55:43.781467+00","2025-09-05 14:39:38.390126+00"
|
||||
|
2
bdd/data_test/notifications.csv
Normal file
2
bdd/data_test/notifications.csv
Normal file
@ -0,0 +1,2 @@
|
||||
"id","id_utilisateur","contenu","lu","cree_le"
|
||||
"71e90c37-f2cb-4aff-ad34-1c728f620afb","bbcae75c-0e60-4b84-b281-079dba23b44e","Votre dossier a été accepté",False,"2025-09-02 12:57:42.845264+00"
|
||||
|
5
bdd/data_test/parents.csv
Normal file
5
bdd/data_test/parents.csv
Normal file
@ -0,0 +1,5 @@
|
||||
"id_utilisateur","id_co_parent"
|
||||
"b6c4d2e3-5f7a-4b8c-9d1e-2a3c5f7b8d9e","f1d3c5b7-8a9e-4f2d-9c1b-3e7a5d8c2f1b"
|
||||
"c4e2d1f5-6b7a-4c3d-8f2a-1e9c3b5a7d6f",
|
||||
"d3e5f7a9-1c2b-4d6e-8f3a-2b4c6d8e9f1a",
|
||||
"f1d3c5b7-8a9e-4f2d-9c1b-3e7a5d8c2f1b","b6c4d2e3-5f7a-4b8c-9d1e-2a3c5f7b8d9e"
|
||||
|
2
bdd/data_test/uploads.csv
Normal file
2
bdd/data_test/uploads.csv
Normal file
@ -0,0 +1,2 @@
|
||||
"id","id_utilisateur","fichier_url","type","cree_le"
|
||||
"db1eb36d-5f30-4027-b529-1d972b79180a","bbcae75c-0e60-4b84-b281-079dba23b44e","https://placeholder.local/file","image","2025-09-02 12:57:35.140078+00"
|
||||
|
12
bdd/data_test/utilisateurs.csv
Normal file
12
bdd/data_test/utilisateurs.csv
Normal file
@ -0,0 +1,12 @@
|
||||
"id","email","password","prenom","nom","genre","role","statut","telephone","adresse","photo_url","consentement_photo","date_consentement_photo","changement_mdp_obligatoire","cree_le","modifie_le","ville","code_postal","mobile","telephone_fixe","profession","situation_familiale","date_naissance"
|
||||
"62de8e71-8082-4383-a3a2-4277bdd07516","am1@example.com","hash125","Claire","Martin","F","assistante_maternelle","actif","0609091011","5 place Bellecour",,False,,False,"2025-09-02 12:30:48.724463+00","2025-09-02 12:30:48.724463+00","Lyon","69002",,,,,
|
||||
"76c40571-5da6-4d27-8e07-303185875b36","gest1@example.com","hash126","Paul","Lemoine","H","gestionnaire","actif","0612131415","10 rue Victor Hugo",,False,,False,"2025-09-02 12:30:48.724463+00","2025-09-02 12:30:48.724463+00","Paris","75002",,,,,
|
||||
"9bc30373-91a4-45ed-9c05-ffe1651ad906","coparent@example.com","hash124","Marc","Durand","H","parent","actif","0605060708","45 avenue de Lyon",,False,,False,"2025-09-02 12:30:48.724463+00","2025-09-02 12:30:48.724463+00","Lyon","69000",,,,,
|
||||
"a1f3d5c7-8b9a-4e2f-9c1d-3b2a4f6e7d8c","fatima.elmansouri@ptits-pas.fr","password","Fatima","El Mansouri",,"assistante_maternelle","actif",,"17 Boulevard Aristide Briand",,False,,False,"2025-09-04 11:49:22.636003+00","2025-09-04 11:49:22.636003+00","Bezons","95870","06 75 45 67 89","01 39 98 78 90","Assistante maternelle","marie","1975-11-12"
|
||||
"b6c4d2e3-5f7a-4b8c-9d1e-2a3c5f7b8d9e","julien.rousseau@ptits-pas.fr","password","Julien","Rousseau",,"parent","actif",,"14 Rue Pasteur",,False,,False,"2025-09-04 11:49:22.636003+00","2025-09-04 11:49:22.636003+00","Bezons","95870","06 56 67 78 89","01 39 98 01 23","Commercial","divorce","1985-08-29"
|
||||
"bbcae75c-0e60-4b84-b281-079dba23b44e","parent1@example.com","hash123","Alice","Dupont","F","parent","actif","0601020304","12 rue de Paris",,False,,False,"2025-09-02 12:30:48.724463+00","2025-09-02 12:30:48.724463+00","Paris","75001",,,,,
|
||||
"c4e2d1f5-6b7a-4c3d-8f2a-1e9c3b5a7d6f","claire.martin@ptits-pas.fr","password","Claire","Martin",,"parent","actif",,"5 Avenue du Général de Gaulle",,False,,False,"2025-09-04 11:49:22.636003+00","2025-09-04 11:49:22.636003+00","Bezons","95870","06 89 56 78 90","01 39 98 89 01","Infirmière","marie","1990-04-03"
|
||||
"d3e5f7a9-1c2b-4d6e-8f3a-2b4c6d8e9f1a","david.lecomte@ptits-pas.fr","password","David","Lecomte",,"parent","actif",,"31 Rue Émile Zola",,False,,False,"2025-09-04 11:49:22.636003+00","2025-09-04 11:49:22.636003+00","Bezons","95870","06 45 56 67 78","01 39 98 12 34","Développeur web","celibataire","1992-10-07"
|
||||
"d9c2e3f4-5b6a-4c3d-9f1a-2e7b3c5d8a1f","marie.dubois@ptits-pas.fr","password","Marie","Dubois",,"assistante_maternelle","actif",,"25 Rue de la République",,False,,False,"2025-09-04 11:49:22.636003+00","2025-09-04 12:44:51.654512+00","Bezons","95870","06 96 34 56 78","01 39 98 67 89","Assistante maternelle","marie","1980-06-08"
|
||||
"f1d3c5b7-8a9e-4f2d-9c1b-3e7a5d8c2f1b","amelie.durand@ptits-pas.fr","password","Amélie","Durand",,"parent","actif",,"23 Rue Victor Hugo",,False,,False,"2025-09-04 11:49:22.636003+00","2025-09-04 11:49:22.636003+00","Bezons","95870","06 67 78 89 90","01 39 98 90 12","Comptable","divorce","1987-12-14"
|
||||
"f3b1a2d4-1c7e-4c2f-8b1a-9d3a8e2f5b6c","sophie.bernard@ptits-pas.fr","password","Sophie","Bernard",,"administrateur","actif",,"12 Avenue Gabriel Péri",,False,,False,"2025-09-04 11:49:22.636003+00","2025-09-04 11:49:22.636003+00","Bezons","95870","06 78 12 34 56","01 39 98 45 67","Responsable administrative","marie","1978-03-15"
|
||||
|
4
bdd/data_test/validations.csv
Normal file
4
bdd/data_test/validations.csv
Normal file
@ -0,0 +1,4 @@
|
||||
"id","id_utilisateur","type","statut","cree_le","modifie_le","valide_par","commentaire"
|
||||
"8ec99565-e8c2-469f-9641-01b99b8281eb","62de8e71-8082-4383-a3a2-4277bdd07516","identité","valide","2025-09-02 12:57:49.846424+00","2025-09-02 12:57:49.846424+00",,
|
||||
"be1c4779-341b-436d-b17e-8bc486d22ef8","62de8e71-8082-4383-a3a2-4277bdd07516",,"valide","2025-09-09 14:47:01.963573+00","2025-09-09 14:47:01.963573+00",,"Contrôle OK"
|
||||
"fcc45701-5708-4368-b467-b95ddb7e1580","d9c2e3f4-5b6a-4c3d-9f1a-2e7b3c5d8a1f",,"valide","2025-09-09 14:52:47.339858+00","2025-09-09 14:52:47.339858+00","76c40571-5da6-4d27-8e07-303185875b36","Contrôle OK"
|
||||
|
@ -14,14 +14,16 @@ services:
|
||||
ports:
|
||||
- "5433:5432"
|
||||
volumes:
|
||||
- ./migrations/01_init.sql:/docker-entrypoint-initdb.d/01_init.sql
|
||||
- postgres_standalone_data:/var/lib/postgresql/data
|
||||
- ./migrations/01_init.sql:/docker-entrypoint-initdb.d/01_init.sql
|
||||
- ./migrations/07_import.sql:/docker-entrypoint-initdb.d/07_import.sql
|
||||
- ./bdd/data_test:/bdd/data_test
|
||||
- postgres_standalone_data:/var/lib/postgresql/data
|
||||
networks:
|
||||
- ptitspas_dev
|
||||
|
||||
# Interface d'administration DB
|
||||
pgadmin:
|
||||
image: dpage/pgadmin4
|
||||
image: dpage/pgadmin4:9.8
|
||||
container_name: ptitspas-pgadmin-standalone
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
@ -33,6 +35,8 @@ services:
|
||||
- postgres
|
||||
networks:
|
||||
- ptitspas_dev
|
||||
volumes:
|
||||
- ./pgadmin/servers.json:/pgadmin4/servers.json
|
||||
|
||||
volumes:
|
||||
postgres_standalone_data:
|
||||
|
||||
@ -5,7 +5,7 @@ CREATE EXTENSION IF NOT EXISTS "pgcrypto";
|
||||
-- ==========================================================
|
||||
DO $$ BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'role_type') THEN
|
||||
CREATE TYPE role_type AS ENUM ('parent', 'gestionnaire', 'super_admin', 'assistante_maternelle');
|
||||
CREATE TYPE role_type AS ENUM ('parent', 'gestionnaire', 'super_admin', 'assistante_maternelle','administrateur');
|
||||
END IF;
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'genre_type') THEN
|
||||
CREATE TYPE genre_type AS ENUM ('H', 'F', 'Autre');
|
||||
@ -41,9 +41,9 @@ END $$;
|
||||
-- ==========================================================
|
||||
CREATE TABLE utilisateurs (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
courriel VARCHAR(255) NOT NULL UNIQUE,
|
||||
CHECK (courriel ~* '^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$'),
|
||||
mot_de_passe_hash TEXT NOT NULL,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
CHECK (email ~* '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$'),
|
||||
password TEXT NOT NULL,
|
||||
prenom VARCHAR(100),
|
||||
nom VARCHAR(100),
|
||||
genre genre_type,
|
||||
@ -58,7 +58,12 @@ CREATE TABLE utilisateurs (
|
||||
cree_le TIMESTAMPTZ DEFAULT now(),
|
||||
modifie_le TIMESTAMPTZ DEFAULT now(),
|
||||
ville VARCHAR(150),
|
||||
code_postal VARCHAR(10)
|
||||
code_postal VARCHAR(10),
|
||||
mobile VARCHAR(20),
|
||||
telephone_fixe VARCHAR(20),
|
||||
profession VARCHAR(150),
|
||||
situation_familiale VARCHAR(50),
|
||||
date_naissance DATE
|
||||
);
|
||||
|
||||
-- ==========================================================
|
||||
@ -67,18 +72,19 @@ CREATE TABLE utilisateurs (
|
||||
CREATE TABLE assistantes_maternelles (
|
||||
id_utilisateur UUID PRIMARY KEY REFERENCES utilisateurs(id) ON DELETE CASCADE,
|
||||
numero_agrement VARCHAR(50),
|
||||
date_naissance DATE,
|
||||
ville_naissance VARCHAR(100),
|
||||
pays_naissance CHAR(2),
|
||||
nir_chiffre CHAR(15),
|
||||
nb_max_enfants INT,
|
||||
biographie TEXT,
|
||||
disponible BOOLEAN DEFAULT true,
|
||||
ville_residence VARCHAR(100)
|
||||
ville_residence VARCHAR(100),
|
||||
date_agrement DATE,
|
||||
annee_experience SMALLINT,
|
||||
specialite VARCHAR(100),
|
||||
place_disponible INT
|
||||
);
|
||||
|
||||
-- ==========================================================
|
||||
-- Table : parents
|
||||
-- Table : parentschange les donnée de init
|
||||
-- ==========================================================
|
||||
CREATE TABLE parents (
|
||||
id_utilisateur UUID PRIMARY KEY REFERENCES utilisateurs(id) ON DELETE CASCADE,
|
||||
@ -232,7 +238,9 @@ CREATE TABLE validations (
|
||||
type VARCHAR(50),
|
||||
statut statut_validation_type DEFAULT 'en_attente',
|
||||
cree_le TIMESTAMPTZ DEFAULT now(),
|
||||
modifie_le TIMESTAMPTZ DEFAULT now()
|
||||
modifie_le TIMESTAMPTZ DEFAULT now(),
|
||||
valide_par UUID REFERENCES utilisateurs(id),
|
||||
commentaire TEXT
|
||||
);
|
||||
|
||||
|
||||
@ -242,10 +250,10 @@ CREATE TABLE validations (
|
||||
|
||||
INSERT INTO utilisateurs (
|
||||
id,
|
||||
courriel,
|
||||
mot_de_passe_hash,
|
||||
email,
|
||||
password,
|
||||
prenom,
|
||||
nom,admin@ptits-pas.fr
|
||||
nom,
|
||||
role,
|
||||
statut,
|
||||
cree_le,
|
||||
@ -262,4 +270,4 @@ VALUES (
|
||||
now(),
|
||||
now()
|
||||
)
|
||||
ON CONFLICT (courriel) DO NOTHING;
|
||||
ON CONFLICT (email) DO NOTHING;
|
||||
|
||||
42
migrations/07_import.sql
Normal file
42
migrations/07_import.sql
Normal file
@ -0,0 +1,42 @@
|
||||
-- Script d'importation des données CSV dans la base Postgres du docker dev
|
||||
-- À exécuter dans le conteneur ou via psql connecté à la base
|
||||
-- psql -U admin -d ptitpas_db -f /docker-entrypoint-initdb.d/07_import.sql
|
||||
-- Exemple d'utilisation :
|
||||
|
||||
|
||||
-- Import utilisateurs
|
||||
\copy utilisateurs FROM 'bdd/data_test/utilisateurs.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import assistantes_maternelles
|
||||
\copy assistantes_maternelles FROM 'bdd/data_test/assistantes_maternelles.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import parents
|
||||
\copy parents FROM 'bdd/data_test/parents.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import enfants
|
||||
\copy enfants FROM 'bdd/data_test/enfants.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import enfants_parents
|
||||
\copy enfants_parents FROM 'bdd/data_test/enfants_parents.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import dossiers
|
||||
\copy dossiers FROM 'bdd/data_test/dossiers.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import contrats
|
||||
\copy contrats FROM 'bdd/data_test/contrats.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import validations
|
||||
\copy validations FROM 'bdd/data_test/validations.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import notifications
|
||||
\copy notifications FROM 'bdd/data_test/notifications.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import uploads
|
||||
\copy uploads FROM 'bdd/data_test/uploads.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Import evenements
|
||||
\copy evenements FROM 'bdd/data_test/evenements.csv' DELIMITER ',' CSV HEADER;
|
||||
|
||||
-- Remarque :
|
||||
-- Les chemins doivent être accessibles depuis le conteneur Docker (monter le dossier si besoin)
|
||||
-- Adapter l'utilisateur, la base et le chemin si nécessaire
|
||||
13
pgadmin/servers.json
Normal file
13
pgadmin/servers.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"Servers": {
|
||||
"1": {
|
||||
"Name": "Postgres Dev",
|
||||
"Group": "Local",
|
||||
"Host": "postgres",
|
||||
"Port": 5432,
|
||||
"Username": "admin",
|
||||
"SSLMode": "prefer",
|
||||
"MaintenanceDB": "ptitpas_db"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user