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);