diff options
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r-- | server/initializers/migrations/0355-p2p-peer-version.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/server/initializers/migrations/0355-p2p-peer-version.ts b/server/initializers/migrations/0355-p2p-peer-version.ts new file mode 100644 index 000000000..18f23d9b7 --- /dev/null +++ b/server/initializers/migrations/0355-p2p-peer-version.ts | |||
@@ -0,0 +1,41 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | async function up (utils: { | ||
4 | transaction: Sequelize.Transaction, | ||
5 | queryInterface: Sequelize.QueryInterface, | ||
6 | sequelize: Sequelize.Sequelize, | ||
7 | db: any | ||
8 | }): Promise<void> { | ||
9 | |||
10 | { | ||
11 | const data = { | ||
12 | type: Sequelize.INTEGER, | ||
13 | allowNull: true, | ||
14 | defaultValue: null | ||
15 | } | ||
16 | await utils.queryInterface.addColumn('videoStreamingPlaylist', 'p2pMediaLoaderPeerVersion', data) | ||
17 | } | ||
18 | |||
19 | { | ||
20 | const query = `UPDATE "videoStreamingPlaylist" SET "p2pMediaLoaderPeerVersion" = 0;` | ||
21 | await utils.sequelize.query(query) | ||
22 | } | ||
23 | |||
24 | { | ||
25 | const data = { | ||
26 | type: Sequelize.INTEGER, | ||
27 | allowNull: false, | ||
28 | defaultValue: null | ||
29 | } | ||
30 | await utils.queryInterface.changeColumn('videoStreamingPlaylist', 'p2pMediaLoaderPeerVersion', data) | ||
31 | } | ||
32 | } | ||
33 | |||
34 | function down (options) { | ||
35 | throw new Error('Not implemented.') | ||
36 | } | ||
37 | |||
38 | export { | ||
39 | up, | ||
40 | down | ||
41 | } | ||