aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/initializers/migrations/0710-live-sessions.ts
blob: aaac8d9ce46bebad3e69b0fd84300a9204a3d1e1 (plain) (tree)

































                                                                                           
import * as Sequelize from 'sequelize'

async function up (utils: {
  transaction: Sequelize.Transaction
  queryInterface: Sequelize.QueryInterface
  sequelize: Sequelize.Sequelize
  db: any
}): Promise<void> {
  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
}