diff options
Diffstat (limited to 'server/initializers/migrations/0450-streaming-playlist-files.ts')
-rw-r--r-- | server/initializers/migrations/0450-streaming-playlist-files.ts | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/server/initializers/migrations/0450-streaming-playlist-files.ts b/server/initializers/migrations/0450-streaming-playlist-files.ts deleted file mode 100644 index 08e2e3989..000000000 --- a/server/initializers/migrations/0450-streaming-playlist-files.ts +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
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 | db: any | ||
8 | }): Promise<void> { | ||
9 | { | ||
10 | const data = { | ||
11 | type: Sequelize.INTEGER, | ||
12 | allowNull: true, | ||
13 | references: { | ||
14 | model: 'videoStreamingPlaylist', | ||
15 | key: 'id' | ||
16 | }, | ||
17 | onDelete: 'CASCADE' | ||
18 | } | ||
19 | |||
20 | await utils.queryInterface.addColumn('videoFile', 'videoStreamingPlaylistId', data) | ||
21 | } | ||
22 | |||
23 | { | ||
24 | const data = { | ||
25 | type: Sequelize.INTEGER, | ||
26 | allowNull: true | ||
27 | } | ||
28 | |||
29 | await utils.queryInterface.changeColumn('videoFile', 'videoId', data) | ||
30 | } | ||
31 | |||
32 | { | ||
33 | await utils.queryInterface.removeIndex('videoFile', 'video_file_video_id_resolution_fps') | ||
34 | } | ||
35 | |||
36 | { | ||
37 | const query = 'insert into "videoFile" ' + | ||
38 | '(resolution, size, "infoHash", "videoId", "createdAt", "updatedAt", fps, extname, "videoStreamingPlaylistId")' + | ||
39 | '(SELECT "videoFile".resolution, "videoFile".size, \'fake\', NULL, "videoFile"."createdAt", "videoFile"."updatedAt", ' + | ||
40 | '"videoFile"."fps", "videoFile".extname, "videoStreamingPlaylist".id FROM "videoStreamingPlaylist" ' + | ||
41 | 'inner join video ON video.id = "videoStreamingPlaylist"."videoId" inner join "videoFile" ON "videoFile"."videoId" = video.id)' | ||
42 | |||
43 | await utils.sequelize.query(query, { transaction: utils.transaction }) | ||
44 | } | ||
45 | } | ||
46 | |||
47 | function down (options) { | ||
48 | throw new Error('Not implemented.') | ||
49 | } | ||
50 | |||
51 | export { | ||
52 | up, | ||
53 | down | ||
54 | } | ||