Roughed in verify user. Will resist after restructuring users routes

This commit is contained in:
Matthew Dillon 2015-06-25 22:09:58 -08:00
parent e6733b2c2e
commit 05ded17aec
7 changed files with 126 additions and 7 deletions

View file

@ -1,17 +1,23 @@
-- bactdb
-- Matthew R Dillon
CREATE TYPE e_roles AS ENUM('R', 'W', 'A');
-- 'R': read-only, default
-- 'W': read-write
-- 'A': administrator
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'e_roles') THEN
CREATE TYPE e_roles AS ENUM('R', 'W', 'A');
-- 'R': read-only, default
-- 'W': read-write
-- 'A': administrator
END IF;
END$$;
CREATE TABLE users (
CREATE TABLE IF NOT EXISTS users (
id BIGSERIAL NOT NULL,
email CHARACTER VARYING(254) NOT NULL UNIQUE,
password CHARACTER(60) NOT NULL,
name TEXT NOT NULL,
role e_roles DEFAULT 'R' NOT NULL,
verified BOOLEAN NOT NULL DEFAULT FALSE,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
updated_at TIMESTAMP WITH TIME ZONE NOT NULL,