forked from athenekilta/ilmomasiina
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Ahlström Kalle <[email protected]>
- Loading branch information
1 parent
f189fb8
commit d999a6c
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
packages/ilmomasiina-backend/src/models/migrations/0005-add-indexes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { defineMigration } from './util'; | ||
|
||
export default defineMigration({ | ||
name: '0005-add-indexes', | ||
async up({ context: { sequelize } }) { | ||
const query = sequelize.getQueryInterface(); | ||
await query.addIndex( | ||
'quota', | ||
{ | ||
name: 'idx_quota_main', | ||
fields: ['eventId', 'deletedAt'], | ||
}, | ||
); | ||
await query.addIndex( | ||
'signup', | ||
{ | ||
name: 'idx_signup_main', | ||
fields: ['quotaId', 'deletedAt', 'confirmedAt', 'createdAt'], | ||
}, | ||
); | ||
await query.addIndex( | ||
'answer', | ||
{ | ||
name: 'idx_answer_main', | ||
fields: ['signupId', 'questionId', 'deletedAt'], | ||
}, | ||
); | ||
}, | ||
async down({ context: { sequelize } }) { | ||
const query = sequelize.getQueryInterface(); | ||
await query.removeIndex('quota', 'idx_quota_main'); | ||
await query.removeIndex('signup', 'idx_signup_main'); | ||
await query.removeIndex('answer', 'idx_answer_main'); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters