]>
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, | |
dc133480 C |
16 | "myVideoPublished" INTEGER NOT NULL DEFAULT NULL, |
17 | "myVideoImportFinished" INTEGER NOT NULL DEFAULT NULL, | |
e8d246d5 C |
18 | "userId" INTEGER REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE CASCADE, |
19 | "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL, | |
20 | "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL, | |
21 | PRIMARY KEY ("id")) | |
22 | ` | |
23 | await utils.sequelize.query(query) | |
24 | } | |
25 | ||
26 | { | |
27 | const query = 'INSERT INTO "userNotificationSetting" ' + | |
28 | '("newVideoFromSubscription", "newCommentOnMyVideo", "videoAbuseAsModerator", "blacklistOnMyVideo", ' + | |
dc133480 C |
29 | '"myVideoPublished", "myVideoImportFinished", "userId", "createdAt", "updatedAt") ' + |
30 | '(SELECT 2, 2, 4, 4, 2, 2, id, NOW(), NOW() FROM "user")' | |
e8d246d5 C |
31 | |
32 | await utils.sequelize.query(query) | |
33 | } | |
34 | } | |
35 | ||
36 | function down (options) { | |
37 | throw new Error('Not implemented.') | |
38 | } | |
39 | ||
40 | export { | |
41 | up, | |
42 | down | |
43 | } |