1 import * as Sequelize from 'sequelize'
3 async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
9 const { transaction } = utils
13 CREATE TABLE IF NOT EXISTS "localVideoViewer" (
15 "startDate" timestamp with time zone NOT NULL,
16 "endDate" timestamp with time zone NOT NULL,
17 "watchTime" integer NOT NULL,
18 "country" varchar(255),
20 "url" varchar(255) NOT NULL,
21 "videoId" integer NOT NULL REFERENCES "video" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
22 "createdAt" timestamp with time zone NOT NULL,
26 await utils.sequelize.query(query, { transaction })
31 CREATE TABLE IF NOT EXISTS "localVideoViewerWatchSection" (
33 "watchStart" integer NOT NULL,
34 "watchEnd" integer NOT NULL,
35 "localVideoViewerId" integer NOT NULL REFERENCES "localVideoViewer" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
36 "createdAt" timestamp with time zone NOT NULL,
40 await utils.sequelize.query(query, { transaction })
46 throw new Error('Not implemented.')