From 83a06bfbd18e4f539b8e42e8e65d719040863100 Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Sun, 3 Mar 2019 02:39:24 -0500 Subject: record meme invocations --- .../2019-03-03-045503_meme_invocation_records/down.sql | 5 +++++ migrations/2019-03-03-045503_meme_invocation_records/up.sql | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 migrations/2019-03-03-045503_meme_invocation_records/down.sql create mode 100644 migrations/2019-03-03-045503_meme_invocation_records/up.sql (limited to 'migrations/2019-03-03-045503_meme_invocation_records') 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); -- cgit v1.3.1