diff options
Diffstat (limited to 'migrations')
| -rw-r--r-- | migrations/2019-03-03-045503_meme_invocation_records/down.sql | 5 | ||||
| -rw-r--r-- | migrations/2019-03-03-045503_meme_invocation_records/up.sql | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/migrations/2019-03-03-045503_meme_invocation_records/down.sql b/migrations/2019-03-03-045503_meme_invocation_records/down.sql new file mode 100644 index 0000000..41333ae --- /dev/null +++ b/migrations/2019-03-03-045503_meme_invocation_records/down.sql @@ -0,0 +1,5 @@ +DROP INDEX invocation_user_id; +DROP INDEX invocation_time; +DROP INDEX invocation_meme_random; + +DROP TABLE invocation_records; diff --git a/migrations/2019-03-03-045503_meme_invocation_records/up.sql b/migrations/2019-03-03-045503_meme_invocation_records/up.sql new file mode 100644 index 0000000..a81c273 --- /dev/null +++ b/migrations/2019-03-03-045503_meme_invocation_records/up.sql @@ -0,0 +1,12 @@ +CREATE TABLE invocation_records ( + id SERIAL PRIMARY KEY, + user_id BIGINT NOT NULL, + message_id BIGINT NOT NULL, + meme_id INTEGER NOT NULL, + time TIMESTAMP NOT NULL DEFAULT current_timestamp, + random BOOLEAN NOT NULL +); + +CREATE INDEX invocation_user_id ON invocation_records (user_id); +CREATE INDEX invocation_time ON invocation_records (time); +CREATE INDEX invocation_meme_random ON invocation_records (meme_id, random); |
