2022-11-04 18:40:14 +01:00
|
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
|
|
|
|
|
|
|
|
CREATE TYPE "AccountState" AS ENUM (
|
|
|
|
'active',
|
|
|
|
'suspended',
|
|
|
|
'banned'
|
2022-11-29 15:18:31 +01:00
|
|
|
);
|
2022-11-04 18:40:14 +01:00
|
|
|
|
|
|
|
CREATE TYPE "Role" AS ENUM (
|
|
|
|
'admin',
|
|
|
|
'user'
|
2022-11-29 15:18:31 +01:00
|
|
|
);
|
2022-11-04 18:40:14 +01:00
|
|
|
|
2022-11-29 15:18:31 +01:00
|
|
|
CREATE TABLE public.accounts
|
|
|
|
(
|
|
|
|
id serial NOT NULL,
|
|
|
|
email character varying NOT NULL,
|
|
|
|
login character varying NOT NULL,
|
|
|
|
pass_hash character varying NOT NULL,
|
|
|
|
role "Role" DEFAULT 'user'::"Role" NOT NULL,
|
|
|
|
customer_id uuid DEFAULT gen_random_uuid() NOT NULL,
|
|
|
|
state "AccountState" DEFAULT 'active'::"AccountState" NOT NULL
|
2022-11-04 18:40:14 +01:00
|
|
|
);
|