ニジカ投稿局 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.
 
 
 
 
 

49 lines
1.0 KiB

  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. {
  9. const data = {
  10. type: Sequelize.STRING,
  11. allowNull: true,
  12. defaultValue: null
  13. }
  14. await utils.queryInterface.addColumn('videoCaption', 'filename', data)
  15. }
  16. {
  17. const query = `UPDATE "videoCaption" SET "filename" = s.uuid || '-' || s.language || '.vtt' ` +
  18. `FROM (` +
  19. ` SELECT "videoCaption"."id", video.uuid, "videoCaption".language ` +
  20. ` FROM "videoCaption" INNER JOIN video ON video.id = "videoCaption"."videoId"` +
  21. `) AS s ` +
  22. `WHERE "videoCaption".id = s.id`
  23. await utils.sequelize.query(query)
  24. }
  25. {
  26. const data = {
  27. type: Sequelize.STRING,
  28. allowNull: false,
  29. defaultValue: null
  30. }
  31. await utils.queryInterface.changeColumn('videoCaption', 'filename', data)
  32. }
  33. }
  34. function down (options) {
  35. throw new Error('Not implemented.')
  36. }
  37. export {
  38. up,
  39. down
  40. }