diff options
Diffstat (limited to 'server/initializers/migrations/0700-edition-finished-notification.ts')
-rw-r--r-- | server/initializers/migrations/0700-edition-finished-notification.ts | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/server/initializers/migrations/0700-edition-finished-notification.ts b/server/initializers/migrations/0700-edition-finished-notification.ts new file mode 100644 index 000000000..103c0b456 --- /dev/null +++ b/server/initializers/migrations/0700-edition-finished-notification.ts | |||
@@ -0,0 +1,42 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | async function up (utils: { | ||
4 | transaction: Sequelize.Transaction | ||
5 | queryInterface: Sequelize.QueryInterface | ||
6 | sequelize: Sequelize.Sequelize | ||
7 | db: any | ||
8 | }): Promise<void> { | ||
9 | const { transaction } = utils | ||
10 | |||
11 | { | ||
12 | const data = { | ||
13 | type: Sequelize.INTEGER, | ||
14 | defaultValue: null, | ||
15 | allowNull: true | ||
16 | } | ||
17 | await utils.queryInterface.addColumn('userNotificationSetting', 'myVideoEditionFinished', data, { transaction }) | ||
18 | } | ||
19 | |||
20 | { | ||
21 | const query = 'UPDATE "userNotificationSetting" SET "myVideoEditionFinished" = 1' | ||
22 | await utils.sequelize.query(query, { transaction }) | ||
23 | } | ||
24 | |||
25 | { | ||
26 | const data = { | ||
27 | type: Sequelize.INTEGER, | ||
28 | defaultValue: null, | ||
29 | allowNull: false | ||
30 | } | ||
31 | await utils.queryInterface.changeColumn('userNotificationSetting', 'myVideoEditionFinished', data, { transaction }) | ||
32 | } | ||
33 | } | ||
34 | |||
35 | function down () { | ||
36 | throw new Error('Not implemented.') | ||
37 | } | ||
38 | |||
39 | export { | ||
40 | up, | ||
41 | down | ||
42 | } | ||