Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix migrations

Chocobozzz4805cff179cb
diff --git a/scripts/release.sh b/scripts/release.sh
index 0a78fe9905..0e288a49c5 100755
--- a/scripts/release.sh
+++ b/scripts/release.sh
@@ -53,7 +53,6 @@ zip -r "PeerTube/$zip_name" "$directory_name/CREDITS.md" "$directory_name/FAQ.md
"$directory_name/dist" "$directory_name/package.json" \
"$directory_name/scripts" "$directory_name/support" \
"$directory_name/tsconfig.json" "$directory_name/yarn.lock" \
- "$directory_name/server/" "$directory_name/shared/" \
|| exit -1
rm "$directory_name" || exit -1
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index a88f9642ca..03828f54f0 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -12,7 +12,7 @@ let config: IConfig = require('config')
// ---------------------------------------------------------------------------
-const LAST_MIGRATION_VERSION = 185
+const LAST_MIGRATION_VERSION = 190
// ---------------------------------------------------------------------------
diff --git a/server/initializers/migrations/0190-video-comment-unique-url.ts b/server/initializers/migrations/0190-video-comment-unique-url.ts
new file mode 100644
index 0000000000..b196c93529
--- /dev/null
+++ b/server/initializers/migrations/0190-video-comment-unique-url.ts
@@ -0,0 +1,23 @@
+import * as Sequelize from 'sequelize'
+
+async function up (utils: {
+ transaction: Sequelize.Transaction,
+ queryInterface: Sequelize.QueryInterface,
+ sequelize: Sequelize.Sequelize
+}): Promise<void> {
+ {
+ const query = 'DELETE FROM "videoComment" s1 ' +
+ 'USING (SELECT MIN(id) as id, url FROM "videoComment" GROUP BY "url" HAVING COUNT(*) > 1) s2 ' +
+ 'WHERE s1."url" = s2."url" AND s1.id <> s2.id'
+ await utils.sequelize.query(query)
+ }
+}
+
+function down (options) {
+ throw new Error('Not implemented.')
+}
+
+export {
+ up,
+ down
+}
diff --git a/support/doc/production.md b/support/doc/production.md
index 56d00bf569..6bf6c1ca38 100644
--- a/support/doc/production.md
+++ b/support/doc/production.md
@@ -280,28 +280,29 @@ $ cd /var/www/peertube/versions && \
sudo -u peertube rm peertube-${VERSION}.zip
```
-Change the link to point to the latest version:
+Install node dependencies:
```
-$ cd /var/www/peertube && \
- sudo rm ./peertube-latest && \
- sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest
+$ cd /var/www/peertube/versions/peertube-${VERSION} && \
+ sudo -u peertube yarn install --production --pure-lockfile
```
-Install node dependencies:
+Copy new configuration defaults values and update your configuration file:
```
-$ cd /var/www/peertube/peertube-latest && \
- sudo -u peertube yarn install --production --pure-lockfile
+$ sudo -u peertube cp /var/www/peertube/versions/peertube-${VERSION}/config/default.yaml /var/www/peertube/config/default.yaml
+$ diff /var/www/peertube/versions/peertube-${VERSION}/config//production.yaml.example /var/www/peertube/config/production.yaml
```
-Copy new configuration defaults values and update your configuration file:
+Change the link to point to the latest version:
```
-$ sudo -u peertube cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml
-$ diff /var/www/peertube/peertube-latest/config//production.yaml.example /var/www/peertube/config/production.yaml
+$ cd /var/www/peertube && \
+ sudo rm ./peertube-latest && \
+ sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest
```
+
Restart PeerTube:
```
$ sudo systemctl restart peertube