aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-10 16:54:01 +0200
committerChocobozzz <me@florianbigard.com>2018-08-10 16:54:01 +0200
commit268eebed921ac13a9ce0f4717f4923aa24190657 (patch)
tree52f8436968c8dcc686663ef5db8dffd7ed191d34 /server/initializers/migrations
parent904a463c7792837f0a468a522a28448323e48593 (diff)
downloadPeerTube-268eebed921ac13a9ce0f4717f4923aa24190657.tar.gz
PeerTube-268eebed921ac13a9ce0f4717f4923aa24190657.tar.zst
PeerTube-268eebed921ac13a9ce0f4717f4923aa24190657.zip
Add state and moderationComment for abuses on server side
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r--server/initializers/migrations/0250-video-abuse-state.ts47
1 files changed, 47 insertions, 0 deletions
diff --git a/server/initializers/migrations/0250-video-abuse-state.ts b/server/initializers/migrations/0250-video-abuse-state.ts
new file mode 100644
index 000000000..acb668ae1
--- /dev/null
+++ b/server/initializers/migrations/0250-video-abuse-state.ts
@@ -0,0 +1,47 @@
1import * as Sequelize from 'sequelize'
2import { CONSTRAINTS_FIELDS } from '../constants'
3import { VideoAbuseState } from '../../../shared/models/videos'
4
5async function up (utils: {
6 transaction: Sequelize.Transaction
7 queryInterface: Sequelize.QueryInterface
8 sequelize: Sequelize.Sequelize
9}): Promise<any> {
10 {
11 const data = {
12 type: Sequelize.INTEGER,
13 allowNull: true,
14 defaultValue: null
15 }
16 await utils.queryInterface.addColumn('videoAbuse', 'state', data)
17 }
18
19 {
20 const query = 'UPDATE "videoAbuse" SET "state" = ' + VideoAbuseState.PENDING
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('videoAbuse', 'state', data)
31 }
32
33 {
34 const data = {
35 type: Sequelize.STRING(CONSTRAINTS_FIELDS.VIDEO_ABUSES.MODERATION_COMMENT.max),
36 allowNull: true,
37 defaultValue: null
38 }
39 await utils.queryInterface.addColumn('videoAbuse', 'moderationComment', data)
40 }
41}
42
43function down (options) {
44 throw new Error('Not implemented.')
45}
46
47export { up, down }