mirror of
https://github.com/outline/outline.git
synced 2026-11-26 07:33:19 +03:00
feat: add indexes
This commit is contained in:
1 parent
5a9af5fa15
commit
c18b24564f
1 file changed
+36
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
async up(queryInterface, Sequelize) {
|
||||
await queryInterface.sequelize.transaction(async (transaction) => {
|
||||
await queryInterface.addIndex("notifications", ["createdAt"], {
|
||||
transaction,
|
||||
});
|
||||
await queryInterface.addIndex("notifications", ["event"], {
|
||||
transaction,
|
||||
});
|
||||
await queryInterface.addIndex("notifications", ["viewedAt"], {
|
||||
where: {
|
||||
viewedAt: {
|
||||
[Sequelize.Op.is]: null,
|
||||
},
|
||||
},
|
||||
transaction,
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
async down(queryInterface) {
|
||||
await queryInterface.sequelize.transaction(async (transaction) => {
|
||||
await queryInterface.removeIndex("notifications", ["createdAt"], {
|
||||
transaction,
|
||||
});
|
||||
await queryInterface.removeIndex("notifications", ["event"], {
|
||||
transaction,
|
||||
});
|
||||
await queryInterface.removeIndex("notifications", ["viewedAt"], {
|
||||
transaction,
|
||||
});
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user