17 lines
422 B
JavaScript
17 lines
422 B
JavaScript
'use strict';
|
||
|
||
/** 为 users.email 增加唯一索引(MySQL 唯一索引允许多个 NULL,历史空邮箱数据不受影响) */
|
||
module.exports = {
|
||
async up(queryInterface) {
|
||
await queryInterface.addIndex('users', {
|
||
fields: [ 'email' ],
|
||
unique: true,
|
||
name: 'uk_users_email',
|
||
});
|
||
},
|
||
|
||
async down(queryInterface) {
|
||
await queryInterface.removeIndex('users', 'uk_users_email');
|
||
},
|
||
};
|