diff --git a/capsulflask/schema_migrations/19_down_api_tokens.py b/capsulflask/schema_migrations/19_down_api_tokens.py new file mode 100644 index 0000000..c915d4a --- /dev/null +++ b/capsulflask/schema_migrations/19_down_api_tokens.py @@ -0,0 +1,2 @@ +DROP TABLE api_keys; +UPDATE schemaversion SET version = 16; diff --git a/capsulflask/schema_migrations/19_up_api_tokens.py b/capsulflask/schema_migrations/19_up_api_tokens.py new file mode 100644 index 0000000..e17d67e --- /dev/null +++ b/capsulflask/schema_migrations/19_up_api_tokens.py @@ -0,0 +1,9 @@ +CREATE TABLE api_tokens ( + id SERIAL PRIMARY KEY, + email TEXT REFERENCES accounts(email) ON DELETE RESTRICT, + name TEXT NOT NULL, + created TIMESTAMP NOT NULL DEFAULT NOW(), + token TEXT NOT NULL +); + +UPDATE schemaversion SET version = 17;