diff options
author | Chocobozzz <me@florianbigard.com> | 2018-10-08 12:04:52 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-10-08 12:04:52 +0200 |
commit | 54b3316099ed7d2dfcb6d708fdb686f1e125ce61 (patch) | |
tree | 139ddac59e41de0c3949647e8a53d8c20ca2de57 /server/initializers/migrations/0275-video-file-unique.ts | |
parent | 87bc58e159e305ecada996368deb87376c50647e (diff) | |
parent | 6321cbc3e7a43257b03b3285ab69b7977fd7f616 (diff) | |
download | PeerTube-54b3316099ed7d2dfcb6d708fdb686f1e125ce61.tar.gz PeerTube-54b3316099ed7d2dfcb6d708fdb686f1e125ce61.tar.zst PeerTube-54b3316099ed7d2dfcb6d708fdb686f1e125ce61.zip |
Merge branch 'release/v1.0.0' into develop
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' |