From 2a31a7b601f7e88ca312d9cbbb92e263bf3ce846 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Tue, 4 Jan 2022 22:00:30 +0900 Subject: [PATCH] Define email_singups table --- .../down.sql | 2 +- .../up.sql | 10 +++++++++- .../down.sql | 1 + .../up.sql | 9 +++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 migrations/sqlite/2022-01-04-122156_create_email_signups_table/down.sql create mode 100644 migrations/sqlite/2022-01-04-122156_create_email_signups_table/up.sql diff --git a/migrations/postgres/2022-01-04-122156_create_email_signups_table/down.sql b/migrations/postgres/2022-01-04-122156_create_email_signups_table/down.sql index 291a97c5..40af0a6c 100644 --- a/migrations/postgres/2022-01-04-122156_create_email_signups_table/down.sql +++ b/migrations/postgres/2022-01-04-122156_create_email_signups_table/down.sql @@ -1 +1 @@ --- This file should undo anything in `up.sql` \ No newline at end of file +DROP TABLE email_signups; diff --git a/migrations/postgres/2022-01-04-122156_create_email_signups_table/up.sql b/migrations/postgres/2022-01-04-122156_create_email_signups_table/up.sql index 33cf74b5..720509f6 100644 --- a/migrations/postgres/2022-01-04-122156_create_email_signups_table/up.sql +++ b/migrations/postgres/2022-01-04-122156_create_email_signups_table/up.sql @@ -1 +1,9 @@ --- Your SQL goes here \ No newline at end of file +CREATE TABLE email_signups ( + id SERIAL PRIMARY KEY, + email VARCHAR NOT NULL, + token VARCHAR NOT NULL, + expiration_date TIMESTAMP NOT NULL +); + +CREATE INDEX email_signups_token ON email_signups (token); +CREATE UNIQUE INDEX email_signups_token_requests_email ON email_signups (email); diff --git a/migrations/sqlite/2022-01-04-122156_create_email_signups_table/down.sql b/migrations/sqlite/2022-01-04-122156_create_email_signups_table/down.sql new file mode 100644 index 00000000..40af0a6c --- /dev/null +++ b/migrations/sqlite/2022-01-04-122156_create_email_signups_table/down.sql @@ -0,0 +1 @@ +DROP TABLE email_signups; diff --git a/migrations/sqlite/2022-01-04-122156_create_email_signups_table/up.sql b/migrations/sqlite/2022-01-04-122156_create_email_signups_table/up.sql new file mode 100644 index 00000000..fa8ce118 --- /dev/null +++ b/migrations/sqlite/2022-01-04-122156_create_email_signups_table/up.sql @@ -0,0 +1,9 @@ +CREATE TABLE email_signups ( + id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + email VARCHAR NOT NULL, + token VARCHAR NOT NULL, + expiration_date TIMESTAMP NOT NULL +); + +CREATE INDEX email_signups_token ON email_signups (token); +CREATE UNIQUE INDEX email_signups_token_requests_email ON email_signups (email);