aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/initializers/constants.ts2
-rw-r--r--server/initializers/migrations/0260-upload-quota-daily.ts (renamed from server/initializers/migrations/0260-upload_quota_daily.ts)0
-rw-r--r--server/initializers/migrations/0275-video-file-unique.ts34
-rw-r--r--server/lib/activitypub/videos.ts2
-rw-r--r--server/models/account/account.ts1
-rw-r--r--server/models/video/video-file.ts4
6 files changed, 38 insertions, 5 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index de426c16e..09ecedfa5 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -16,7 +16,7 @@ let config: IConfig = require('config')
16 16
17// --------------------------------------------------------------------------- 17// ---------------------------------------------------------------------------
18 18
19const LAST_MIGRATION_VERSION = 270 19const LAST_MIGRATION_VERSION = 275
20 20
21// --------------------------------------------------------------------------- 21// ---------------------------------------------------------------------------
22 22
diff --git a/server/initializers/migrations/0260-upload_quota_daily.ts b/server/initializers/migrations/0260-upload-quota-daily.ts
index d25154ba6..d25154ba6 100644
--- a/server/initializers/migrations/0260-upload_quota_daily.ts
+++ b/server/initializers/migrations/0260-upload-quota-daily.ts
diff --git a/server/initializers/migrations/0275-video-file-unique.ts b/server/initializers/migrations/0275-video-file-unique.ts
new file mode 100644
index 000000000..fd89188c0
--- /dev/null
+++ b/server/initializers/migrations/0275-video-file-unique.ts
@@ -0,0 +1,34 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7}): Promise<any> {
8 {
9 const query = 'DELETE FROM "videoFile" vf1 USING "videoFile" vf2 WHERE vf1.id < vf2.id ' +
10 'AND vf1."videoId" = vf2."videoId" AND vf1.resolution = vf2.resolution AND vf1.fps IS NULL'
11 await utils.sequelize.query(query)
12 }
13
14 {
15 const query = 'UPDATE "videoFile" SET fps = -1 WHERE fps IS NULL;'
16 await utils.sequelize.query(query)
17 }
18
19 {
20 const data = {
21 type: Sequelize.INTEGER,
22 allowNull: false,
23 defaultValue: -1
24 }
25 await utils.queryInterface.changeColumn('videoFile', 'fps', data)
26 }
27
28}
29
30function down (options) {
31 throw new Error('Not implemented.')
32}
33
34export { up, down }
diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts
index db72ef23c..3dccabe12 100644
--- a/server/lib/activitypub/videos.ts
+++ b/server/lib/activitypub/videos.ts
@@ -478,7 +478,7 @@ function videoFileActivityUrlToDBAttributes (videoCreated: VideoModel, videoObje
478 resolution: fileUrl.height, 478 resolution: fileUrl.height,
479 size: fileUrl.size, 479 size: fileUrl.size,
480 videoId: videoCreated.id, 480 videoId: videoCreated.id,
481 fps: fileUrl.fps 481 fps: fileUrl.fps || -1
482 } as VideoFileModel 482 } as VideoFileModel
483 attributes.push(attribute) 483 attributes.push(attribute)
484 } 484 }
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index 580d920ce..27c75d886 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -19,7 +19,6 @@ import { isAccountDescriptionValid } from '../../helpers/custom-validators/accou
19import { sendDeleteActor } from '../../lib/activitypub/send' 19import { sendDeleteActor } from '../../lib/activitypub/send'
20import { ActorModel } from '../activitypub/actor' 20import { ActorModel } from '../activitypub/actor'
21import { ApplicationModel } from '../application/application' 21import { ApplicationModel } from '../application/application'
22import { AvatarModel } from '../avatar/avatar'
23import { ServerModel } from '../server/server' 22import { ServerModel } from '../server/server'
24import { getSort, throwIfNotValid } from '../utils' 23import { getSort, throwIfNotValid } from '../utils'
25import { VideoChannelModel } from '../video/video-channel' 24import { VideoChannelModel } from '../video/video-channel'
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts
index 0887a3738..f040803b9 100644
--- a/server/models/video/video-file.ts
+++ b/server/models/video/video-file.ts
@@ -66,8 +66,8 @@ export class VideoFileModel extends Model<VideoFileModel> {
66 @Column 66 @Column
67 infoHash: string 67 infoHash: string
68 68
69 @AllowNull(true) 69 @AllowNull(false)
70 @Default(null) 70 @Default(-1)
71 @Is('VideoFileFPS', value => throwIfNotValid(value, isVideoFPSResolutionValid, 'fps')) 71 @Is('VideoFileFPS', value => throwIfNotValid(value, isVideoFPSResolutionValid, 'fps'))
72 @Column 72 @Column
73 fps: number 73 fps: number