]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/initializers/migrations/0710-live-sessions.ts
Support live session in server
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0710-live-sessions.ts
CommitLineData
26e3e98f
C
1import * as Sequelize from 'sequelize'
2
3async 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
27function down () {
28 throw new Error('Not implemented.')
29}
30
31export {
32 up,
33 down
34}