capsul-flask/capsulflask/schema_migrations/02_up_accounts_vms_etc.sql
2020-05-09 20:36:14 -05:00

28 lines
663 B
SQL

CREATE TABLE accounts (
email TEXT PRIMARY KEY NOT NULL,
);
CREATE TABLE vms (
id TEXT PRIMARY KEY NOT NULL,
email TEXT REFERENCES accounts(email) ON DELETE RESTRICT,
created TIMESTAMP NOT NULL,
deleted TIMESTAMP NOT NULL,
);
CREATE TABLE payments (
email TEXT REFERENCES accounts(email) ON DELETE RESTRICT,
created TIMESTAMP NOT NULL,
dollars INTEGER NOT NULL,
PRIMARY KEY (email, created)
);
CREATE TABLE logintokens (
email TEXT REFERENCES accounts(email) ON DELETE RESTRICT,
created TIMESTAMP NOT NULL,
token TEXT NOT NULL,
PRIMARY KEY (email, created)
);
UPDATE schemaversion SET version = 2;