aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-08 14:58:21 +0200
committerChocobozzz <me@florianbigard.com>2018-08-08 15:22:58 +0200
commite69219184b1a3262ec5e617d30337b6431c9840c (patch)
tree959b32e1ed28047052604941870563e946be9de1 /server/initializers/migrations
parent6b09aba90dfe4c61331b66b1a6ef1f58ddc61485 (diff)
downloadPeerTube-e69219184b1a3262ec5e617d30337b6431c9840c.tar.gz
PeerTube-e69219184b1a3262ec5e617d30337b6431c9840c.tar.zst
PeerTube-e69219184b1a3262ec5e617d30337b6431c9840c.zip
Implement user blocking on server side
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r--server/initializers/migrations/0245-user-blocked.ts40
1 files changed, 40 insertions, 0 deletions
diff --git a/server/initializers/migrations/0245-user-blocked.ts b/server/initializers/migrations/0245-user-blocked.ts
new file mode 100644
index 000000000..67afea5ed
--- /dev/null
+++ b/server/initializers/migrations/0245-user-blocked.ts
@@ -0,0 +1,40 @@
1import * as Sequelize from 'sequelize'
2import { createClient } from 'redis'
3import { CONFIG } from '../constants'
4import { JobQueue } from '../../lib/job-queue'
5import { initDatabaseModels } from '../database'
6
7async function up (utils: {
8 transaction: Sequelize.Transaction
9 queryInterface: Sequelize.QueryInterface
10 sequelize: Sequelize.Sequelize
11}): Promise<any> {
12 {
13 const data = {
14 type: Sequelize.BOOLEAN,
15 allowNull: true,
16 defaultValue: null
17 }
18 await utils.queryInterface.addColumn('user', 'blocked', data)
19 }
20
21 {
22 const query = 'UPDATE "user" SET "blocked" = false'
23 await utils.sequelize.query(query)
24 }
25
26 {
27 const data = {
28 type: Sequelize.BOOLEAN,
29 allowNull: false,
30 defaultValue: null
31 }
32 await utils.queryInterface.changeColumn('user', 'blocked', data)
33 }
34}
35
36function down (options) {
37 throw new Error('Not implemented.')
38}
39
40export { up, down }