0310-drop-unused-video-indexes.ts 627 B

1234567891011121314151617181920212223242526272829303132
  1. import * as Sequelize from 'sequelize'
  2. async function up (utils: {
  3. transaction: Sequelize.Transaction,
  4. queryInterface: Sequelize.QueryInterface,
  5. sequelize: Sequelize.Sequelize,
  6. db: any
  7. }): Promise<void> {
  8. const indexNames = [
  9. 'video_category',
  10. 'video_licence',
  11. 'video_nsfw',
  12. 'video_language',
  13. 'video_wait_transcoding',
  14. 'video_state',
  15. 'video_remote',
  16. 'video_likes'
  17. ]
  18. for (const indexName of indexNames) {
  19. await utils.sequelize.query('DROP INDEX IF EXISTS "' + indexName + '";')
  20. }
  21. }
  22. function down (options) {
  23. throw new Error('Not implemented.')
  24. }
  25. export {
  26. up,
  27. down
  28. }