aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0245-user-blocked.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrations/0245-user-blocked.ts')
-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 }