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;