2018-11-08 14:19:42 +00:00
|
|
|
-- AUTOGENERATED BY gopkg.in/spacemonkeygo/dbx.v1
|
|
|
|
-- DO NOT EDIT
|
2018-12-20 16:18:08 +00:00
|
|
|
CREATE TABLE projects (
|
|
|
|
id BLOB NOT NULL,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
description TEXT NOT NULL,
|
|
|
|
terms_accepted INTEGER NOT NULL,
|
|
|
|
created_at TIMESTAMP NOT NULL,
|
|
|
|
PRIMARY KEY ( id )
|
|
|
|
);
|
2018-11-08 14:19:42 +00:00
|
|
|
CREATE TABLE users (
|
2018-11-09 12:05:24 +00:00
|
|
|
id BLOB NOT NULL,
|
2018-11-08 14:19:42 +00:00
|
|
|
first_name TEXT NOT NULL,
|
|
|
|
last_name TEXT NOT NULL,
|
|
|
|
email TEXT NOT NULL,
|
|
|
|
password_hash BLOB NOT NULL,
|
|
|
|
created_at TIMESTAMP NOT NULL,
|
|
|
|
PRIMARY KEY ( id ),
|
|
|
|
UNIQUE ( email )
|
|
|
|
);
|
2018-12-26 14:00:53 +00:00
|
|
|
CREATE TABLE api_keys (
|
|
|
|
id BLOB NOT NULL,
|
|
|
|
project_id BLOB NOT NULL REFERENCES projects( id ) ON DELETE CASCADE,
|
|
|
|
key BLOB NOT NULL,
|
|
|
|
name TEXT NOT NULL,
|
|
|
|
created_at TIMESTAMP NOT NULL,
|
|
|
|
PRIMARY KEY ( id ),
|
|
|
|
UNIQUE ( key ),
|
|
|
|
UNIQUE ( name, project_id )
|
|
|
|
);
|
2018-11-20 14:50:47 +00:00
|
|
|
CREATE TABLE project_members (
|
|
|
|
member_id BLOB NOT NULL REFERENCES users( id ) ON DELETE CASCADE,
|
|
|
|
project_id BLOB NOT NULL REFERENCES projects( id ) ON DELETE CASCADE,
|
2018-11-13 08:27:42 +00:00
|
|
|
created_at TIMESTAMP NOT NULL,
|
2018-12-10 12:29:01 +00:00
|
|
|
PRIMARY KEY ( member_id, project_id )
|
2018-11-13 08:27:42 +00:00
|
|
|
);
|