capsul-flask/capsulflask/schema_migrations/02_up_accounts_vms_etc.sql

28 lines
663 B
MySQL
Raw Normal View History

2020-05-10 01:36:14 +00:00
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;