diff options
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/constants.ts | 7 | ||||
-rw-r--r-- | server/initializers/migrations/0255-video-blacklist-reason.ts | 25 |
2 files changed, 30 insertions, 2 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index a008bf4c5..ff8e64330 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -15,7 +15,7 @@ let config: IConfig = require('config') | |||
15 | 15 | ||
16 | // --------------------------------------------------------------------------- | 16 | // --------------------------------------------------------------------------- |
17 | 17 | ||
18 | const LAST_MIGRATION_VERSION = 250 | 18 | const LAST_MIGRATION_VERSION = 255 |
19 | 19 | ||
20 | // --------------------------------------------------------------------------- | 20 | // --------------------------------------------------------------------------- |
21 | 21 | ||
@@ -34,7 +34,7 @@ const SORTABLE_COLUMNS = { | |||
34 | USERS: [ 'id', 'username', 'createdAt' ], | 34 | USERS: [ 'id', 'username', 'createdAt' ], |
35 | ACCOUNTS: [ 'createdAt' ], | 35 | ACCOUNTS: [ 'createdAt' ], |
36 | JOBS: [ 'createdAt' ], | 36 | JOBS: [ 'createdAt' ], |
37 | VIDEO_ABUSES: [ 'id', 'createdAt' ], | 37 | VIDEO_ABUSES: [ 'id', 'createdAt', 'state' ], |
38 | VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ], | 38 | VIDEO_CHANNELS: [ 'id', 'name', 'updatedAt', 'createdAt' ], |
39 | VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes' ], | 39 | VIDEOS: [ 'name', 'duration', 'createdAt', 'publishedAt', 'views', 'likes' ], |
40 | VIDEO_IMPORTS: [ 'createdAt' ], | 40 | VIDEO_IMPORTS: [ 'createdAt' ], |
@@ -261,6 +261,9 @@ const CONSTRAINTS_FIELDS = { | |||
261 | REASON: { min: 2, max: 300 }, // Length | 261 | REASON: { min: 2, max: 300 }, // Length |
262 | MODERATION_COMMENT: { min: 2, max: 300 } // Length | 262 | MODERATION_COMMENT: { min: 2, max: 300 } // Length |
263 | }, | 263 | }, |
264 | VIDEO_BLACKLIST: { | ||
265 | REASON: { min: 2, max: 300 } // Length | ||
266 | }, | ||
264 | VIDEO_CHANNELS: { | 267 | VIDEO_CHANNELS: { |
265 | NAME: { min: 3, max: 120 }, // Length | 268 | NAME: { min: 3, max: 120 }, // Length |
266 | DESCRIPTION: { min: 3, max: 500 }, // Length | 269 | DESCRIPTION: { min: 3, max: 500 }, // Length |
diff --git a/server/initializers/migrations/0255-video-blacklist-reason.ts b/server/initializers/migrations/0255-video-blacklist-reason.ts new file mode 100644 index 000000000..a380e620e --- /dev/null +++ b/server/initializers/migrations/0255-video-blacklist-reason.ts | |||
@@ -0,0 +1,25 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | import { CONSTRAINTS_FIELDS } from '../constants' | ||
3 | import { VideoAbuseState } from '../../../shared/models/videos' | ||
4 | |||
5 | async function up (utils: { | ||
6 | transaction: Sequelize.Transaction | ||
7 | queryInterface: Sequelize.QueryInterface | ||
8 | sequelize: Sequelize.Sequelize | ||
9 | }): Promise<any> { | ||
10 | |||
11 | { | ||
12 | const data = { | ||
13 | type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_BLACKLIST.REASON.max), | ||
14 | allowNull: true, | ||
15 | defaultValue: null | ||
16 | } | ||
17 | await utils.queryInterface.addColumn('videoBlacklist', 'reason', data) | ||
18 | } | ||
19 | } | ||
20 | |||
21 | function down (options) { | ||
22 | throw new Error('Not implemented.') | ||
23 | } | ||
24 | |||
25 | export { up, down } | ||