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

68 lines
1.6 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. }): Promise<void> {
  7. const { transaction } = utils
  8. // Notification
  9. {
  10. await utils.queryInterface.addColumn('userNotification', 'videoCaptionId', {
  11. type: Sequelize.INTEGER,
  12. defaultValue: null,
  13. allowNull: true,
  14. references: {
  15. model: 'videoCaption',
  16. key: 'id'
  17. },
  18. onUpdate: 'CASCADE',
  19. onDelete: 'CASCADE'
  20. }, { transaction })
  21. }
  22. // Notification settings
  23. {
  24. {
  25. const data = {
  26. type: Sequelize.INTEGER,
  27. defaultValue: null,
  28. allowNull: true
  29. }
  30. await utils.queryInterface.addColumn('userNotificationSetting', 'myVideoTranscriptionGenerated', data, { transaction })
  31. }
  32. {
  33. const query = 'UPDATE "userNotificationSetting" SET "myVideoTranscriptionGenerated" = 1'
  34. await utils.sequelize.query(query, { transaction })
  35. }
  36. {
  37. const data = {
  38. type: Sequelize.INTEGER,
  39. defaultValue: null,
  40. allowNull: false
  41. }
  42. await utils.queryInterface.changeColumn('userNotificationSetting', 'myVideoTranscriptionGenerated', data, { transaction })
  43. }
  44. }
  45. // Video job info
  46. {
  47. await utils.queryInterface.addColumn('videoJobInfo', 'pendingTranscription', {
  48. type: Sequelize.INTEGER,
  49. allowNull: false,
  50. defaultValue: 0
  51. }, { transaction })
  52. }
  53. }
  54. function down (options) {
  55. throw new Error('Not implemented.')
  56. }
  57. export {
  58. down, up
  59. }