24 lines
765 B
SQL
24 lines
765 B
SQL
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
|
|
|
|
CREATE TYPE "AccountState" AS ENUM (
|
|
'active',
|
|
'suspended',
|
|
'banned'
|
|
);
|
|
|
|
CREATE TYPE "Role" AS ENUM (
|
|
'admin',
|
|
'user'
|
|
);
|
|
|
|
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
|
|
);
|