From 01c6abdbb49a7aa965d7888b38fe24f37433a2cb Mon Sep 17 00:00:00 2001 From: William Petit Date: Sun, 21 Jun 2020 14:23:13 +0200 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20r=C3=B4le=20dans=20la=20fichie=20u?= =?UTF-8?q?tilisateur=20+=20cr=C3=A9ation=20de=20fixtures=20avec=20les=20r?= =?UTF-8?q?=C3=B4les=20user/admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/config/migrations/0_init.sql | 4 ++-- backend/config/seed.js | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/backend/config/migrations/0_init.sql b/backend/config/migrations/0_init.sql index 17d993c..6db6d3c 100644 --- a/backend/config/migrations/0_init.sql +++ b/backend/config/migrations/0_init.sql @@ -5,7 +5,8 @@ CREATE TABLE public.users ( full_name text, email text UNIQUE NOT NULL CHECK (length(email) < 255), created_at timestamptz NOT NULL NOT NULL DEFAULT NOW(), - updated_at timestamptz NOT NULL NOT NULL DEFAULT NOW() + updated_at timestamptz NOT NULL NOT NULL DEFAULT NOW(), + role varchar(64) ); ---- create above / drop below ---- @@ -14,4 +15,3 @@ CREATE TABLE public.users ( -- then delete the separator line above. DROP TABLE public.users - diff --git a/backend/config/seed.js b/backend/config/seed.js index 84d50c3..f016d11 100644 --- a/backend/config/seed.js +++ b/backend/config/seed.js @@ -1,21 +1,25 @@ -// Example script to seed database +// Voir https://supergraph.dev/docs/seed var users = [ { - full_name: 'William Petit', - email: 'wpetit@cadoles.com' + full_name: 'Admin', + email: 'admin@cadoles.com', + role: 'admin', }, { - full_name: 'Teddy Cornaut', - email: 'tcornaut@cadoles.com' + full_name: 'User 1', + email: 'user1@cadoles.com', + role: 'user', }, { - full_name: 'Benjamin Gaudé', - email: 'bgaude@cadoles.com' + full_name: 'User 2', + email: 'user2@cadoles.com', + role: 'user', }, { - full_name: 'Charles Maxime Sassot', - email: 'cmsassot@cadoles.com' + full_name: 'User 3', + email: 'user3@cadoles.com', + role: 'user', } ];