]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/initializers/migrations/0535-video-live.ts
store uploaded video filename (#4885)
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0535-video-live.ts
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 }): Promise<void> {
8 {
9 const query = `
10 CREATE TABLE IF NOT EXISTS "videoLive" (
11 "id" SERIAL ,
12 "streamKey" VARCHAR(255),
13 "videoId" INTEGER NOT NULL REFERENCES "video" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
14 "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL,
15 "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL,
16 PRIMARY KEY ("id")
17 );
18 `
19
20 await utils.sequelize.query(query)
21 }
22
23 {
24 await utils.queryInterface.addColumn('video', 'isLive', {
25 type: Sequelize.BOOLEAN,
26 defaultValue: false,
27 allowNull: false
28 })
29 }
30 }
31
32 function down (options) {
33 throw new Error('Not implemented.')
34 }
35
36 export {
37 up,
38 down
39 }