trade-backend/migrations/20260314153309-add-transactions-indexes.cjs
2026-03-14 15:38:03 +07:00

20 lines
790 B
JavaScript

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
await queryInterface.addIndex('Transactions', ['buy_order_id', 'status'], {
name: 'transactions_buy_order_id_status',
});
await queryInterface.addIndex('Transactions', ['sell_order_id', 'status'], {
name: 'transactions_sell_order_id_status',
});
await queryInterface.addIndex('Transactions', ['timestamp'], {
name: 'transactions_timestamp',
});
},
async down(queryInterface) {
await queryInterface.removeIndex('Transactions', 'transactions_buy_order_id_status');
await queryInterface.removeIndex('Transactions', 'transactions_sell_order_id_status');
await queryInterface.removeIndex('Transactions', 'transactions_timestamp');
},
};