From d35ec807ff39c4c32349eb48e0e02705391de42f Mon Sep 17 00:00:00 2001 From: Ethan Ho Date: Fri, 6 Dec 2024 16:49:54 -0800 Subject: [PATCH] Update users.sql --- server/db/schema/users.sql | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/server/db/schema/users.sql b/server/db/schema/users.sql index 81c31b7..e145232 100644 --- a/server/db/schema/users.sql +++ b/server/db/schema/users.sql @@ -2,12 +2,17 @@ -- DROP TABLE IF EXISTS public.users; +CREATE TYPE USER_ROLE AS ENUM('student', 'teacher', 'admin'); + CREATE TABLE IF NOT EXISTS public.users ( id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), email character varying(256) COLLATE pg_catalog."default" NOT NULL, firebase_uid character varying(128) COLLATE pg_catalog."default" NOT NULL, role character varying(16) COLLATE pg_catalog."default" NOT NULL DEFAULT 'user'::character varying, + first_name character varying(128) NOT NULL, + last_name character varying(128) NOT NULL, + user_role USER_ROLE NOT NULL, CONSTRAINT user_pkey PRIMARY KEY (id), CONSTRAINT email UNIQUE (email), CONSTRAINT firebase_uid UNIQUE (firebase_uid), @@ -16,5 +21,5 @@ CREATE TABLE IF NOT EXISTS public.users TABLESPACE pg_default; -ALTER TABLE IF EXISTS public.users - OWNER to postgres; +-- ALTER TABLE IF EXISTS public.users +-- OWNER to postgres;