From 8bc226eb4cee47e82ad6c8117fc78a01d616332e Mon Sep 17 00:00:00 2001 From: les Date: Wed, 29 Jan 2020 18:37:52 +0100 Subject: [PATCH] holy shit https://github.com/sequelize/sequelize/issues/10360 --- .../20200129173454-user_email_index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 server/migrations/20200129173454-user_email_index.js diff --git a/server/migrations/20200129173454-user_email_index.js b/server/migrations/20200129173454-user_email_index.js new file mode 100644 index 00000000..009386d4 --- /dev/null +++ b/server/migrations/20200129173454-user_email_index.js @@ -0,0 +1,19 @@ + +module.exports = { + up: (queryInterface, Sequelize) => { + return queryInterface.addIndex('users', { + unique: true, + fields: ['email'] + }).catch(e => {}) + }, + + down: (queryInterface, Sequelize) => { + /* + Add reverting commands here. + Return a promise to correctly handle asynchronicity. + + Example: + return queryInterface.dropTable('users'); + */ + } +};