aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-10-08 11:58:18 +0200
committerChocobozzz <me@florianbigard.com>2018-10-08 11:58:18 +0200
commit6321cbc3e7a43257b03b3285ab69b7977fd7f616 (patch)
tree66ad62b8da49629cf7ab0f9a8123c7764d204a45 /server
parent505319061e28da647c2e9af6e65721d6b8f9da1b (diff)
downloadPeerTube-6321cbc3e7a43257b03b3285ab69b7977fd7f616.tar.gz
PeerTube-6321cbc3e7a43257b03b3285ab69b7977fd7f616.tar.zst
PeerTube-6321cbc3e7a43257b03b3285ab69b7977fd7f616.zip
Avoid old issue regarding duplicated hosts in db
Diffstat (limited to 'server')
-rw-r--r--server/initializers/migrations/0275-video-file-unique.ts6
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'