diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-11 11:52:34 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-11 11:52:34 +0100 |
commit | 88108880bbdba473cfe36ecbebc1c3c4f972e102 (patch) | |
tree | b242efb3b4f0d7e49d88f2d1f2063b5b3b0489c0 /server/initializers/migrations/0275-video-file-unique.ts | |
parent | 53a94c7cfa8368da4cd248d65df8346905938f0c (diff) | |
parent | 9b712a2017e4ab3cf12cd6bd58278905520159d0 (diff) | |
download | PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.gz PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.tar.zst PeerTube-88108880bbdba473cfe36ecbebc1c3c4f972e102.zip |
Merge branch 'develop' into pr/1217
Diffstat (limited to 'server/initializers/migrations/0275-video-file-unique.ts')
-rw-r--r-- | server/initializers/migrations/0275-video-file-unique.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/initializers/migrations/0275-video-file-unique.ts b/server/initializers/migrations/0275-video-file-unique.ts index fd89188c0..e321ecb04 100644 --- a/server/initializers/migrations/0275-video-file-unique.ts +++ b/server/initializers/migrations/0275-video-file-unique.ts | |||
@@ -5,6 +5,12 @@ async function up (utils: { | |||
5 | queryInterface: Sequelize.QueryInterface | 5 | queryInterface: Sequelize.QueryInterface |
6 | sequelize: Sequelize.Sequelize | 6 | sequelize: Sequelize.Sequelize |
7 | }): Promise<any> { | 7 | }): Promise<any> { |
8 | // Delete duplicated keys | ||
9 | { | ||
10 | const query = 'DELETE FROM "server" s1 USING "server" s2 WHERE s1.id < s2.id AND s1."host" = s2."host"' | ||
11 | await utils.sequelize.query(query) | ||
12 | } | ||
13 | |||
8 | { | 14 | { |
9 | const query = 'DELETE FROM "videoFile" vf1 USING "videoFile" vf2 WHERE vf1.id < vf2.id ' + | 15 | const query = 'DELETE FROM "videoFile" vf1 USING "videoFile" vf2 WHERE vf1.id < vf2.id ' + |
10 | 'AND vf1."videoId" = vf2."videoId" AND vf1.resolution = vf2.resolution AND vf1.fps IS NULL' | 16 | 'AND vf1."videoId" = vf2."videoId" AND vf1.resolution = vf2.resolution AND vf1.fps IS NULL' |