aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0690-live-latency-mode.ts
blob: c31a6136413dccc3329d76bb2189648db190a630 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { LiveVideoLatencyMode } from '@shared/models'
import * as Sequelize from 'sequelize'

async function up (utils: {
  transaction: Sequelize.Transaction
  queryInterface: Sequelize.QueryInterface
  sequelize: Sequelize.Sequelize
  db: any
}): Promise<void> {
  await utils.queryInterface.addColumn('videoLive', 'latencyMode', {
    type: Sequelize.INTEGER,
    defaultValue: null,
    allowNull: true
  }, { transaction: utils.transaction })

  {
    const query = `UPDATE "videoLive" SET "latencyMode" = ${LiveVideoLatencyMode.DEFAULT}`
    await utils.sequelize.query(query, { type: Sequelize.QueryTypes.UPDATE, transaction: utils.transaction })
  }

  await utils.queryInterface.changeColumn('videoLive', 'latencyMode', {
    type: Sequelize.INTEGER,
    defaultValue: null,
    allowNull: false
  }, { transaction: utils.transaction })
}

function down () {
  throw new Error('Not implemented.')
}

export {
  up,
  down
}