diff options
Diffstat (limited to 'server/initializers/migrations/0245-user-blocked.ts')
-rw-r--r-- | server/initializers/migrations/0245-user-blocked.ts | 40 |
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 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | import { createClient } from 'redis' | ||
3 | import { CONFIG } from '../constants' | ||
4 | import { JobQueue } from '../../lib/job-queue' | ||
5 | import { initDatabaseModels } from '../database' | ||
6 | |||
7 | async 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 | |||
36 | function down (options) { | ||
37 | throw new Error('Not implemented.') | ||
38 | } | ||
39 | |||
40 | export { up, down } | ||