]>
Commit | Line | Data |
---|---|---|
e8d246d5 C |
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 | }): Promise<void> { | |
8 | ||
9 | { | |
10 | const query = ` | |
11 | CREATE TABLE IF NOT EXISTS "userNotificationSetting" ("id" SERIAL, | |
12 | "newVideoFromSubscription" INTEGER NOT NULL DEFAULT NULL, | |
13 | "newCommentOnMyVideo" INTEGER NOT NULL DEFAULT NULL, | |
14 | "videoAbuseAsModerator" INTEGER NOT NULL DEFAULT NULL, | |
15 | "blacklistOnMyVideo" INTEGER NOT NULL DEFAULT NULL, | |
16 | "userId" INTEGER REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE, | |
17 | "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, | |
18 | "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, | |
19 | PRIMARY KEY ("id")) | |
20 | ` | |
21 | await utils.sequelize.query(query) | |
22 | } | |
23 | ||
24 | { | |
25 | const query = 'INSERT INTO "userNotificationSetting" ' + | |
26 | '("newVideoFromSubscription", "newCommentOnMyVideo", "videoAbuseAsModerator", "blacklistOnMyVideo", ' + | |
27 | '"userId", "createdAt", "updatedAt") ' + | |
28 | '(SELECT 2, 2, 4, 4, id, NOW(), NOW() FROM "user")' | |
29 | ||
30 | await utils.sequelize.query(query) | |
31 | } | |
32 | } | |
33 | ||
34 | function down (options) { | |
35 | throw new Error('Not implemented.') | |
36 | } | |
37 | ||
38 | export { | |
39 | up, | |
40 | down | |
41 | } |