aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-08 11:13:49 +0200
committerChocobozzz <me@florianbigard.com>2019-04-08 11:16:14 +0200
commitae9bbed46dbc8d9870c9feb66bbada484c1c7582 (patch)
tree69a04af65274f9f39cb439384ad58b1fc1058ba0 /server/initializers
parent14aed608f540b587b3ab2529d06690815214d232 (diff)
downloadPeerTube-ae9bbed46dbc8d9870c9feb66bbada484c1c7582.tar.gz
PeerTube-ae9bbed46dbc8d9870c9feb66bbada484c1c7582.tar.zst
PeerTube-ae9bbed46dbc8d9870c9feb66bbada484c1c7582.zip
Update P2P media loader peer version
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts5
-rw-r--r--server/initializers/migrations/0355-p2p-peer-version.ts41
2 files changed, 45 insertions, 1 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index f59d3ef7a..ac19231d0 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -18,7 +18,7 @@ let config: IConfig = require('config')
18 18
19// --------------------------------------------------------------------------- 19// ---------------------------------------------------------------------------
20 20
21const LAST_MIGRATION_VERSION = 350 21const LAST_MIGRATION_VERSION = 355
22 22
23// --------------------------------------------------------------------------- 23// ---------------------------------------------------------------------------
24 24
@@ -726,6 +726,8 @@ const TRACKER_RATE_LIMITS = {
726 ANNOUNCES_PER_IP: 30 // maximum announces for all our torrents in the interval 726 ANNOUNCES_PER_IP: 30 // maximum announces for all our torrents in the interval
727} 727}
728 728
729const P2P_MEDIA_LOADER_PEER_VERSION = 2
730
729// --------------------------------------------------------------------------- 731// ---------------------------------------------------------------------------
730 732
731// Special constants for a test instance 733// Special constants for a test instance
@@ -772,6 +774,7 @@ updateWebserverUrls()
772export { 774export {
773 API_VERSION, 775 API_VERSION,
774 HLS_REDUNDANCY_DIRECTORY, 776 HLS_REDUNDANCY_DIRECTORY,
777 P2P_MEDIA_LOADER_PEER_VERSION,
775 AVATARS_SIZE, 778 AVATARS_SIZE,
776 ACCEPT_HEADERS, 779 ACCEPT_HEADERS,
777 BCRYPT_SALT_SIZE, 780 BCRYPT_SALT_SIZE,
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 @@
1import * as Sequelize from 'sequelize'
2
3async 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
34function down (options) {
35 throw new Error('Not implemented.')
36}
37
38export {
39 up,
40 down
41}