0690-live-latency-mode.ts 944 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { LiveVideoLatencyMode } from '@peertube/peertube-models'
  2. import * as Sequelize from 'sequelize'
  3. async function up (utils: {
  4. transaction: Sequelize.Transaction
  5. queryInterface: Sequelize.QueryInterface
  6. sequelize: Sequelize.Sequelize
  7. db: any
  8. }): Promise<void> {
  9. await utils.queryInterface.addColumn('videoLive', 'latencyMode', {
  10. type: Sequelize.INTEGER,
  11. defaultValue: null,
  12. allowNull: true
  13. }, { transaction: utils.transaction })
  14. {
  15. const query = `UPDATE "videoLive" SET "latencyMode" = ${LiveVideoLatencyMode.DEFAULT}`
  16. await utils.sequelize.query(query, { type: Sequelize.QueryTypes.UPDATE, transaction: utils.transaction })
  17. }
  18. await utils.queryInterface.changeColumn('videoLive', 'latencyMode', {
  19. type: Sequelize.INTEGER,
  20. defaultValue: null,
  21. allowNull: false
  22. }, { transaction: utils.transaction })
  23. }
  24. function down () {
  25. throw new Error('Not implemented.')
  26. }
  27. export {
  28. up,
  29. down
  30. }