diff options
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r-- | server/initializers/migrations/0350-video-blacklist-type.ts | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/server/initializers/migrations/0350-video-blacklist-type.ts b/server/initializers/migrations/0350-video-blacklist-type.ts new file mode 100644 index 000000000..4849020ef --- /dev/null +++ b/server/initializers/migrations/0350-video-blacklist-type.ts | |||
@@ -0,0 +1,64 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | import { VideoBlacklistType } from '../../../shared/models/videos' | ||
3 | |||
4 | async function up (utils: { | ||
5 | transaction: Sequelize.Transaction, | ||
6 | queryInterface: Sequelize.QueryInterface, | ||
7 | sequelize: Sequelize.Sequelize, | ||
8 | db: any | ||
9 | }): Promise<void> { | ||
10 | { | ||
11 | const data = { | ||
12 | type: Sequelize.INTEGER, | ||
13 | allowNull: true, | ||
14 | defaultValue: null | ||
15 | } | ||
16 | |||
17 | await utils.queryInterface.addColumn('videoBlacklist', 'type', data) | ||
18 | } | ||
19 | |||
20 | { | ||
21 | const query = 'UPDATE "videoBlacklist" SET "type" = ' + VideoBlacklistType.MANUAL | ||
22 | await utils.sequelize.query(query) | ||
23 | } | ||
24 | |||
25 | { | ||
26 | const data = { | ||
27 | type: Sequelize.INTEGER, | ||
28 | allowNull: false, | ||
29 | defaultValue: null | ||
30 | } | ||
31 | await utils.queryInterface.changeColumn('videoBlacklist', 'type', data) | ||
32 | } | ||
33 | |||
34 | { | ||
35 | const data = { | ||
36 | type: Sequelize.INTEGER, | ||
37 | defaultValue: null, | ||
38 | allowNull: true | ||
39 | } | ||
40 | await utils.queryInterface.addColumn('userNotificationSetting', 'videoAutoBlacklistAsModerator', data) | ||
41 | } | ||
42 | |||
43 | { | ||
44 | const query = 'UPDATE "userNotificationSetting" SET "videoAutoBlacklistAsModerator" = 3' | ||
45 | await utils.sequelize.query(query) | ||
46 | } | ||
47 | |||
48 | { | ||
49 | const data = { | ||
50 | type: Sequelize.INTEGER, | ||
51 | defaultValue: null, | ||
52 | allowNull: false | ||
53 | } | ||
54 | await utils.queryInterface.changeColumn('userNotificationSetting', 'videoAutoBlacklistAsModerator', data) | ||
55 | } | ||
56 | } | ||
57 | function down (options) { | ||
58 | throw new Error('Not implemented.') | ||
59 | } | ||
60 | |||
61 | export { | ||
62 | up, | ||
63 | down | ||
64 | } | ||