diff options
Diffstat (limited to 'backend/migrations')
| -rw-r--r-- | backend/migrations/20200205194947_user_add_activated_email.js | 13 | ||||
| -rw-r--r-- | backend/migrations/20200205200212_add_activate_code_token_type.js | 17 |
2 files changed, 30 insertions, 0 deletions
diff --git a/backend/migrations/20200205194947_user_add_activated_email.js b/backend/migrations/20200205194947_user_add_activated_email.js new file mode 100644 index 0000000..cf58c35 --- /dev/null +++ b/backend/migrations/20200205194947_user_add_activated_email.js @@ -0,0 +1,13 @@ +exports.up = function(knex) { + return knex.schema.table('users', function(table) { + table.string('email').notNullable().default(''); + table.boolean('activated').notNullable().default(false); + }); +}; + +exports.down = function(knex) { + return knex.schema.table('users', function(table) { + table.dropColumn('email'); + table.dropColumn('activated'); + }); +}; diff --git a/backend/migrations/20200205200212_add_activate_code_token_type.js b/backend/migrations/20200205200212_add_activate_code_token_type.js new file mode 100644 index 0000000..b1c264c --- /dev/null +++ b/backend/migrations/20200205200212_add_activate_code_token_type.js @@ -0,0 +1,17 @@ +exports.up = function(knex) { + return knex.schema.raw(` + ALTER TABLE "tokens" + DROP CONSTRAINT "tokens_type_check", + ADD CONSTRAINT "tokens_type_check" + CHECK (type IN ('session', 'activation')) + `); +}; + +exports.down = function(knex) { + return knex.schema.raw(` + ALTER TABLE "tokens" + DROP CONSTRAINT "tokens_type_check", + ADD CONSTRAINT "tokens_type_check" + CHECK (type IN ('session')) + `); +}; |
