]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/initializers/migrations/0660-object-storage.ts
store uploaded video filename (#4885)
[github/Chocobozzz/PeerTube.git] / server / initializers / migrations / 0660-object-storage.ts
CommitLineData
0305db28
JB
1import * as Sequelize from 'sequelize'
2import { VideoStorage } from '@shared/models'
3
4async function up (utils: {
5 transaction: Sequelize.Transaction
6 queryInterface: Sequelize.QueryInterface
7 sequelize: Sequelize.Sequelize
8 db: any
9}): Promise<void> {
10 {
11 const query = `
12 CREATE TABLE IF NOT EXISTS "videoJobInfo" (
13 "id" serial,
14 "pendingMove" INTEGER NOT NULL,
15 "pendingTranscode" INTEGER NOT NULL,
16 "videoId" serial UNIQUE NOT NULL REFERENCES "video" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
17 "createdAt" timestamp WITH time zone NOT NULL,
18 "updatedAt" timestamp WITH time zone NOT NULL,
19 PRIMARY KEY ("id")
20 );
21 `
22
23 await utils.sequelize.query(query)
24 }
25
26 {
e5d3e0c7
C
27 await utils.queryInterface.addColumn('videoFile', 'storage', {
28 type: Sequelize.INTEGER,
29 allowNull: true,
30 defaultValue: VideoStorage.FILE_SYSTEM
31 })
32 await utils.queryInterface.changeColumn('videoFile', 'storage', { type: Sequelize.INTEGER, allowNull: false, defaultValue: null })
0305db28
JB
33 }
34
35 {
e5d3e0c7
C
36 await utils.queryInterface.addColumn('videoStreamingPlaylist', 'storage', {
37 type: Sequelize.INTEGER,
38 allowNull: true,
39 defaultValue: VideoStorage.FILE_SYSTEM
40 })
41 await utils.queryInterface.changeColumn('videoStreamingPlaylist', 'storage', {
42 type: Sequelize.INTEGER,
43 allowNull: false,
44 defaultValue: null
45 })
0305db28
JB
46 }
47}
48
49function down (options) {
50 throw new Error('Not implemented.')
51}
52
53export {
54 up,
55 down
56}