Files
micromdm/internal/data/migrations/postgres/initial_tables.sql
Victor Vrantchan 1d698cd23e Add account management web pages (#694)
Added internal/frontend/account to implement account management code. 
Added user registration templates and handlers.
Set up a sqlite and postgres database in package main.
2020-07-25 20:34:59 -04:00

17 lines
520 B
SQL

DROP TABLE IF EXISTS users;
CREATE TABLE IF NOT EXISTS users (
id text PRIMARY KEY NOT NULL,
username text NOT NULL DEFAULT '',
email text NOT NULL DEFAULT '',
password bytea NOT NULL,
salt bytea NOT NULL,
confirmation_hash text,
created_at timestamptz DEFAULT (now() at time zone 'utc'),
updated_at timestamptz DEFAULT (now() at time zone 'utc'),
CONSTRAINT chk_username_not_empty CHECK (username != ''),
CONSTRAINT chk_email_not_empty CHECK (email != ''),
UNIQUE (email),
UNIQUE (username)
);