diff options
author | Chocobozzz <me@florianbigard.com> | 2022-05-03 11:38:07 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-05-03 14:49:15 +0200 |
commit | 26e3e98ff0e222a9fb9226938ac6902af77921bd (patch) | |
tree | 73d1c6f2524e380862d3365f12043fc319d40841 /server/initializers/migrations | |
parent | 86c5229b4d726202378ef46854383bcafca22310 (diff) | |
download | PeerTube-26e3e98ff0e222a9fb9226938ac6902af77921bd.tar.gz PeerTube-26e3e98ff0e222a9fb9226938ac6902af77921bd.tar.zst PeerTube-26e3e98ff0e222a9fb9226938ac6902af77921bd.zip |
Support live session in server
Diffstat (limited to 'server/initializers/migrations')
-rw-r--r-- | server/initializers/migrations/0710-live-sessions.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/server/initializers/migrations/0710-live-sessions.ts b/server/initializers/migrations/0710-live-sessions.ts new file mode 100644 index 000000000..aaac8d9ce --- /dev/null +++ b/server/initializers/migrations/0710-live-sessions.ts | |||
@@ -0,0 +1,34 @@ | |||
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 | const query = ` | ||
12 | CREATE TABLE IF NOT EXISTS "videoLiveSession" ( | ||
13 | "id" serial, | ||
14 | "startDate" timestamp with time zone NOT NULL, | ||
15 | "endDate" timestamp with time zone, | ||
16 | "error" integer, | ||
17 | "replayVideoId" integer REFERENCES "video" ("id") ON DELETE SET NULL ON UPDATE CASCADE, | ||
18 | "liveVideoId" integer REFERENCES "video" ("id") ON DELETE SET NULL 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 | ` | ||
24 | await utils.sequelize.query(query, { transaction }) | ||
25 | } | ||
26 | |||
27 | function down () { | ||
28 | throw new Error('Not implemented.') | ||
29 | } | ||
30 | |||
31 | export { | ||
32 | up, | ||
33 | down | ||
34 | } | ||