diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-04 13:40:02 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-03-09 09:23:10 +0100 |
commit | f443a74649174b2f9347c158e30f8ac7aa3e958a (patch) | |
tree | e423bc4e2307477bda4341037b7fa04ad10adae6 /server/initializers/migrations/0690-live-latency-mode.ts | |
parent | 01dd04cd5ab7b55d2a9af7d0ebf405bee9579b09 (diff) | |
download | PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.gz PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.zst PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.zip |
Add latency setting support
Diffstat (limited to 'server/initializers/migrations/0690-live-latency-mode.ts')
-rw-r--r-- | server/initializers/migrations/0690-live-latency-mode.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/server/initializers/migrations/0690-live-latency-mode.ts b/server/initializers/migrations/0690-live-latency-mode.ts new file mode 100644 index 000000000..c31a61364 --- /dev/null +++ b/server/initializers/migrations/0690-live-latency-mode.ts | |||
@@ -0,0 +1,35 @@ | |||
1 | import { LiveVideoLatencyMode } from '@shared/models' | ||
2 | import * as Sequelize from 'sequelize' | ||
3 | |||
4 | async function up (utils: { | ||
5 | transaction: Sequelize.Transaction | ||
6 | queryInterface: Sequelize.QueryInterface | ||
7 | sequelize: Sequelize.Sequelize | ||
8 | db: any | ||
9 | }): Promise<void> { | ||
10 | await utils.queryInterface.addColumn('videoLive', 'latencyMode', { | ||
11 | type: Sequelize.INTEGER, | ||
12 | defaultValue: null, | ||
13 | allowNull: true | ||
14 | }, { transaction: utils.transaction }) | ||
15 | |||
16 | { | ||
17 | const query = `UPDATE "videoLive" SET "latencyMode" = ${LiveVideoLatencyMode.DEFAULT}` | ||
18 | await utils.sequelize.query(query, { type: Sequelize.QueryTypes.UPDATE, transaction: utils.transaction }) | ||
19 | } | ||
20 | |||
21 | await utils.queryInterface.changeColumn('videoLive', 'latencyMode', { | ||
22 | type: Sequelize.INTEGER, | ||
23 | defaultValue: null, | ||
24 | allowNull: false | ||
25 | }, { transaction: utils.transaction }) | ||
26 | } | ||
27 | |||
28 | function down () { | ||
29 | throw new Error('Not implemented.') | ||
30 | } | ||
31 | |||
32 | export { | ||
33 | up, | ||
34 | down | ||
35 | } | ||