ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

29 lines
854 B

  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 query = 'DELETE FROM "accountVideoRate" ' +
  9. 'WHERE "accountVideoRate".id IN (' +
  10. 'SELECT "accountVideoRate".id FROM "accountVideoRate" ' +
  11. 'INNER JOIN account ON account.id = "accountVideoRate"."accountId" ' +
  12. 'INNER JOIN actor ON actor.id = account."actorId" ' +
  13. 'INNER JOIN video ON video.id = "accountVideoRate"."videoId" ' +
  14. 'WHERE actor."serverId" IS NOT NULL AND video.remote IS TRUE' +
  15. ')'
  16. await utils.sequelize.query(query, { type: Sequelize.QueryTypes.BULKDELETE, transaction: utils.transaction })
  17. }
  18. function down () {
  19. throw new Error('Not implemented.')
  20. }
  21. export {
  22. up,
  23. down
  24. }