aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrations')
-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'