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

48 lines
995 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. }): Promise<void> {
  7. const { transaction } = utils
  8. {
  9. const data = {
  10. type: Sequelize.BOOLEAN,
  11. allowNull: true,
  12. defaultValue: true
  13. }
  14. await utils.queryInterface.addColumn('thumbnail', 'onDisk', data, { transaction })
  15. }
  16. {
  17. // Remote previews are not on the disk
  18. await utils.sequelize.query(
  19. 'UPDATE "thumbnail" SET "onDisk" = FALSE ' +
  20. 'WHERE "type" = 2 AND "videoId" NOT IN (SELECT "id" FROM "video" WHERE "remote" IS FALSE)',
  21. { transaction }
  22. )
  23. }
  24. {
  25. const data = {
  26. type: Sequelize.BOOLEAN,
  27. allowNull: false,
  28. defaultValue: null
  29. }
  30. await utils.queryInterface.changeColumn('thumbnail', 'onDisk', data, { transaction })
  31. }
  32. }
  33. function down (options) {
  34. throw new Error('Not implemented.')
  35. }
  36. export {
  37. up,
  38. down
  39. }