From 26e3e98ff0e222a9fb9226938ac6902af77921bd Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 3 May 2022 11:38:07 +0200 Subject: Support live session in server --- .../initializers/migrations/0710-live-sessions.ts | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 server/initializers/migrations/0710-live-sessions.ts (limited to 'server/initializers/migrations/0710-live-sessions.ts') 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 @@ +import * as Sequelize from 'sequelize' + +async function up (utils: { + transaction: Sequelize.Transaction + queryInterface: Sequelize.QueryInterface + sequelize: Sequelize.Sequelize + db: any +}): Promise { + const { transaction } = utils + + const query = ` + CREATE TABLE IF NOT EXISTS "videoLiveSession" ( + "id" serial, + "startDate" timestamp with time zone NOT NULL, + "endDate" timestamp with time zone, + "error" integer, + "replayVideoId" integer REFERENCES "video" ("id") ON DELETE SET NULL ON UPDATE CASCADE, + "liveVideoId" integer REFERENCES "video" ("id") ON DELETE SET NULL ON UPDATE CASCADE, + "createdAt" timestamp with time zone NOT NULL, + "updatedAt" timestamp with time zone NOT NULL, + PRIMARY KEY ("id") + ); + ` + await utils.sequelize.query(query, { transaction }) +} + +function down () { + throw new Error('Not implemented.') +} + +export { + up, + down +} -- cgit v1.2.3