aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/initializers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-18 11:17:35 +0100
committerChocobozzz <me@florianbigard.com>2022-03-18 11:21:50 +0100
commit57e4e1c1a95c3a81a967f54ecc2a510d8b0e129c (patch)
treefcf12670d643ec4a3b5eccdfa834227c0417d988 /server/initializers
parent2e3f7a5a6fbae276d3ba1cb1b08289917ec7604b (diff)
downloadPeerTube-57e4e1c1a95c3a81a967f54ecc2a510d8b0e129c.tar.gz
PeerTube-57e4e1c1a95c3a81a967f54ecc2a510d8b0e129c.tar.zst
PeerTube-57e4e1c1a95c3a81a967f54ecc2a510d8b0e129c.zip
Don't store remote rates of remote videos
In the future we'll stop to expose all available rates to improve users privacy
Diffstat (limited to 'server/initializers')
-rw-r--r--server/initializers/constants.ts2
-rw-r--r--server/initializers/migrations/0695-remove-remote-rates.ts28
2 files changed, 29 insertions, 1 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index e0f6f2bd2..aaf39e6ec 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -24,7 +24,7 @@ import { CONFIG, registerConfigChangedHandler } from './config'
24 24
25// --------------------------------------------------------------------------- 25// ---------------------------------------------------------------------------
26 26
27const LAST_MIGRATION_VERSION = 690 27const LAST_MIGRATION_VERSION = 695
28 28
29// --------------------------------------------------------------------------- 29// ---------------------------------------------------------------------------
30 30
diff --git a/server/initializers/migrations/0695-remove-remote-rates.ts b/server/initializers/migrations/0695-remove-remote-rates.ts
new file mode 100644
index 000000000..f5c394bae
--- /dev/null
+++ b/server/initializers/migrations/0695-remove-remote-rates.ts
@@ -0,0 +1,28 @@
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 const query = 'DELETE FROM "accountVideoRate" ' +
10 'WHERE "accountVideoRate".id IN (' +
11 'SELECT "accountVideoRate".id FROM "accountVideoRate" ' +
12 'INNER JOIN account ON account.id = "accountVideoRate"."accountId" ' +
13 'INNER JOIN actor ON actor.id = account."actorId" ' +
14 'INNER JOIN video ON video.id = "accountVideoRate"."videoId" ' +
15 'WHERE actor."serverId" IS NOT NULL AND video.remote IS TRUE' +
16 ')'
17
18 await utils.sequelize.query(query, { type: Sequelize.QueryTypes.BULKDELETE, transaction: utils.transaction })
19}
20
21function down () {
22 throw new Error('Not implemented.')
23}
24
25export {
26 up,
27 down
28}