diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-19 16:02:49 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-21 17:38:13 +0200 |
commit | 12dc3a942a13c7f1489822dae052da197ef15905 (patch) | |
tree | 7b87b6be692af0b62ebac17e720c80244fd8a7ec /server/initializers | |
parent | c6867725fb8e3dfbc2018a37ed5a963103587cb6 (diff) | |
download | PeerTube-12dc3a942a13c7f1489822dae052da197ef15905.tar.gz PeerTube-12dc3a942a13c7f1489822dae052da197ef15905.tar.zst PeerTube-12dc3a942a13c7f1489822dae052da197ef15905.zip |
Implement replace file in server side
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/checker-before-init.ts | 1 | ||||
-rw-r--r-- | server/initializers/config.ts | 5 | ||||
-rw-r--r-- | server/initializers/constants.ts | 2 | ||||
-rw-r--r-- | server/initializers/migrations/0800-video-replace-file.ts | 38 |
4 files changed, 45 insertions, 1 deletions
diff --git a/server/initializers/checker-before-init.ts b/server/initializers/checker-before-init.ts index a872fcba3..f77b0defb 100644 --- a/server/initializers/checker-before-init.ts +++ b/server/initializers/checker-before-init.ts | |||
@@ -40,6 +40,7 @@ function checkMissedConfig () { | |||
40 | 'transcoding.resolutions.480p', 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', | 40 | 'transcoding.resolutions.480p', 'transcoding.resolutions.720p', 'transcoding.resolutions.1080p', 'transcoding.resolutions.1440p', |
41 | 'transcoding.resolutions.2160p', 'transcoding.always_transcode_original_resolution', 'transcoding.remote_runners.enabled', | 41 | 'transcoding.resolutions.2160p', 'transcoding.always_transcode_original_resolution', 'transcoding.remote_runners.enabled', |
42 | 'video_studio.enabled', 'video_studio.remote_runners.enabled', | 42 | 'video_studio.enabled', 'video_studio.remote_runners.enabled', |
43 | 'video_file.update.enabled', | ||
43 | 'remote_runners.stalled_jobs.vod', 'remote_runners.stalled_jobs.live', | 44 | 'remote_runners.stalled_jobs.vod', 'remote_runners.stalled_jobs.live', |
44 | 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'import.videos.timeout', | 45 | 'import.videos.http.enabled', 'import.videos.torrent.enabled', 'import.videos.concurrency', 'import.videos.timeout', |
45 | 'import.video_channel_synchronization.enabled', 'import.video_channel_synchronization.max_per_user', | 46 | 'import.video_channel_synchronization.enabled', 'import.video_channel_synchronization.max_per_user', |
diff --git a/server/initializers/config.ts b/server/initializers/config.ts index 37cd852f1..f12d9b85a 100644 --- a/server/initializers/config.ts +++ b/server/initializers/config.ts | |||
@@ -435,6 +435,11 @@ const CONFIG = { | |||
435 | get ENABLED () { return config.get<boolean>('video_studio.remote_runners.enabled') } | 435 | get ENABLED () { return config.get<boolean>('video_studio.remote_runners.enabled') } |
436 | } | 436 | } |
437 | }, | 437 | }, |
438 | VIDEO_FILE: { | ||
439 | UPDATE: { | ||
440 | get ENABLED () { return config.get<boolean>('video_file.update.enabled') } | ||
441 | } | ||
442 | }, | ||
438 | IMPORT: { | 443 | IMPORT: { |
439 | VIDEOS: { | 444 | VIDEOS: { |
440 | get CONCURRENCY () { return config.get<number>('import.videos.concurrency') }, | 445 | get CONCURRENCY () { return config.get<number>('import.videos.concurrency') }, |
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index e09f0e3c6..9e5a02854 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -27,7 +27,7 @@ import { CONFIG, registerConfigChangedHandler } from './config' | |||
27 | 27 | ||
28 | // --------------------------------------------------------------------------- | 28 | // --------------------------------------------------------------------------- |
29 | 29 | ||
30 | const LAST_MIGRATION_VERSION = 795 | 30 | const LAST_MIGRATION_VERSION = 800 |
31 | 31 | ||
32 | // --------------------------------------------------------------------------- | 32 | // --------------------------------------------------------------------------- |
33 | 33 | ||
diff --git a/server/initializers/migrations/0800-video-replace-file.ts b/server/initializers/migrations/0800-video-replace-file.ts new file mode 100644 index 000000000..f924a4d92 --- /dev/null +++ b/server/initializers/migrations/0800-video-replace-file.ts | |||
@@ -0,0 +1,38 @@ | |||
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 | }): Promise<void> { | ||
8 | const { transaction } = utils | ||
9 | |||
10 | { | ||
11 | const query = 'DELETE FROM "videoSource" WHERE "videoId" IS NULL' | ||
12 | await utils.sequelize.query(query, { transaction }) | ||
13 | } | ||
14 | |||
15 | { | ||
16 | const query = 'ALTER TABLE "videoSource" ALTER COLUMN "videoId" SET NOT NULL' | ||
17 | await utils.sequelize.query(query, { transaction }) | ||
18 | } | ||
19 | |||
20 | { | ||
21 | const data = { | ||
22 | type: Sequelize.DATE, | ||
23 | allowNull: true, | ||
24 | defaultValue: null | ||
25 | } | ||
26 | |||
27 | await utils.queryInterface.addColumn('video', 'inputFileUpdatedAt', data, { transaction }) | ||
28 | } | ||
29 | } | ||
30 | |||
31 | function down (options) { | ||
32 | throw new Error('Not implemented.') | ||
33 | } | ||
34 | |||
35 | export { | ||
36 | up, | ||
37 | down | ||
38 | } | ||