bazzar/crates/account_manager/migrations/202204131841_init.sql

23 lines
555 B
MySQL
Raw Normal View History

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'
);
CREATE TYPE "Role" AS ENUM (
'admin',
'user'
);
CREATE TABLE public.accounts (
2022-11-11 16:32:07 +01:00
id serial NOT NULL,
2022-11-04 18:40:14 +01:00
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
);