aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0185-video-share-url.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/initializers/migrations/0185-video-share-url.ts')
-rw-r--r--server/initializers/migrations/0185-video-share-url.ts38
1 files changed, 0 insertions, 38 deletions
diff --git a/server/initializers/migrations/0185-video-share-url.ts b/server/initializers/migrations/0185-video-share-url.ts
deleted file mode 100644
index f59931e0f..000000000
--- a/server/initializers/migrations/0185-video-share-url.ts
+++ /dev/null
@@ -1,38 +0,0 @@
1import * as Sequelize from 'sequelize'
2
3async function up (utils: {
4 transaction: Sequelize.Transaction
5 queryInterface: Sequelize.QueryInterface
6 sequelize: Sequelize.Sequelize
7}): Promise<void> {
8 {
9 const query = 'DELETE FROM "videoShare" s1 ' +
10 'USING (SELECT MIN(id) as id, "actorId", "videoId" FROM "videoShare" GROUP BY "actorId", "videoId" HAVING COUNT(*) > 1) s2 ' +
11 'WHERE s1."actorId" = s2."actorId" AND s1."videoId" = s2."videoId" AND s1.id <> s2.id'
12 await utils.sequelize.query(query)
13 }
14
15 {
16 const data = {
17 type: Sequelize.STRING,
18 allowNull: true,
19 defaultValue: null
20 }
21 await utils.queryInterface.addColumn('videoShare', 'url', data)
22
23 const query = `UPDATE "videoShare" SET "url" = (SELECT "url" FROM "video" WHERE "id" = "videoId") || '/announces/' || "actorId"`
24 await utils.sequelize.query(query)
25
26 data.allowNull = false
27 await utils.queryInterface.changeColumn('videoShare', 'url', data)
28 }
29}
30
31function down (options) {
32 throw new Error('Not implemented.')
33}
34
35export {
36 up,
37 down
38}