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

29 lines
749 B
MySQL
Raw Normal View History

2020-05-10 01:36:14 +00:00
CREATE TABLE accounts (
email TEXT PRIMARY KEY NOT NULL,
2020-05-10 03:59:22 +00:00
created TIMESTAMP NOT NULL DEFAULT NOW()
2020-05-10 01:36:14 +00:00
);
CREATE TABLE vms (
id TEXT PRIMARY KEY NOT NULL,
email TEXT REFERENCES accounts(email) ON DELETE RESTRICT,
2020-05-10 03:59:22 +00:00
created TIMESTAMP NOT NULL DEFAULT NOW(),
deleted TIMESTAMP NOT NULL
2020-05-10 01:36:14 +00:00
);
CREATE TABLE payments (
email TEXT REFERENCES accounts(email) ON DELETE RESTRICT,
2020-05-10 03:59:22 +00:00
created TIMESTAMP NOT NULL DEFAULT NOW(),
2020-05-10 01:36:14 +00:00
dollars INTEGER NOT NULL,
PRIMARY KEY (email, created)
);
CREATE TABLE logintokens (
email TEXT REFERENCES accounts(email) ON DELETE RESTRICT,
2020-05-10 03:59:22 +00:00
created TIMESTAMP NOT NULL DEFAULT NOW(),
2020-05-10 01:36:14 +00:00
token TEXT NOT NULL,
PRIMARY KEY (email, created)
);
UPDATE schemaversion SET version = 2;