aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers/migrations/0305-fix-unfederated-videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-21 14:54:29 +0100
committerChocobozzz <me@florianbigard.com>2022-03-21 14:54:29 +0100
commit348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46 (patch)
tree972ec51091bab14e7671ef7db3b6e43ea5f116f7 /server/initializers/migrations/0305-fix-unfederated-videos.ts
parente6afb669402aead6bf3d9d7ba4f2bd434c831eab (diff)
downloadPeerTube-348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46.tar.gz
PeerTube-348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46.tar.zst
PeerTube-348c2ce3ff3fe2f25a31f08bfb36c88723a0ce46.zip
Remove old migration files
Diffstat (limited to 'server/initializers/migrations/0305-fix-unfederated-videos.ts')
-rw-r--r--server/initializers/migrations/0305-fix-unfederated-videos.ts52
1 files changed, 0 insertions, 52 deletions
diff --git a/server/initializers/migrations/0305-fix-unfederated-videos.ts b/server/initializers/migrations/0305-fix-unfederated-videos.ts
deleted file mode 100644
index 9c5d56b7b..000000000
--- a/server/initializers/migrations/0305-fix-unfederated-videos.ts
+++ /dev/null
@@ -1,52 +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 db: any
8}): Promise<void> {
9 {
10 const query = `INSERT INTO "videoShare" (url, "actorId", "videoId", "createdAt", "updatedAt") ` +
11 `(` +
12 `SELECT ` +
13 `video.url || '/announces/' || "videoChannel"."actorId" as url, ` +
14 `"videoChannel"."actorId" AS "actorId", ` +
15 `"video"."id" AS "videoId", ` +
16 `NOW() AS "createdAt", ` +
17 `NOW() AS "updatedAt" ` +
18 `FROM video ` +
19 `INNER JOIN "videoChannel" ON "video"."channelId" = "videoChannel"."id" ` +
20 `WHERE "video"."remote" = false AND "video"."privacy" != 3 AND "video"."state" = 1` +
21 `) ` +
22 `ON CONFLICT DO NOTHING`
23
24 await utils.sequelize.query(query)
25 }
26
27 {
28 const query = `INSERT INTO "videoShare" (url, "actorId", "videoId", "createdAt", "updatedAt") ` +
29 `(` +
30 `SELECT ` +
31 `video.url || '/announces/' || (SELECT id FROM actor WHERE "preferredUsername" = 'peertube' ORDER BY id ASC LIMIT 1) as url, ` +
32 `(SELECT id FROM actor WHERE "preferredUsername" = 'peertube' ORDER BY id ASC LIMIT 1) AS "actorId", ` +
33 `"video"."id" AS "videoId", ` +
34 `NOW() AS "createdAt", ` +
35 `NOW() AS "updatedAt" ` +
36 `FROM video ` +
37 `WHERE "video"."remote" = false AND "video"."privacy" != 3 AND "video"."state" = 1` +
38 `) ` +
39 `ON CONFLICT DO NOTHING`
40
41 await utils.sequelize.query(query)
42 }
43}
44
45function down (options) {
46 throw new Error('Not implemented.')
47}
48
49export {
50 up,
51 down
52}