ActivityPub-federated video streaming platform using P2P directly in your web browser
More robust migration script
Chocobozzz9cf034c43a09
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c7d3412c50..81d7ccf1c0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,7 @@### IMPORTANT NOTES+ * If your instance has many videos (local or federated) in the database, automatic migrations at next startup can take several minutes to finish. Plan for a short period of downtime during this upgrade* You need to manually execute a migration script **after upgrading**, while PeerTube is running and the database migration is complete (`Migrations finished. New migration version schema: 1125` in PeerTube startup logs):* Classic installation: `cd /var/www/peertube/peertube-latest && sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production node dist/scripts/migrations/peertube-8.3.js`* Docker installation: `cd /var/www/peertube-docker && docker compose exec -u peertube peertube node dist/scripts/migrations/peertube-8.3.js`diff --git a/server/scripts/migrations/peertube-8.3.ts b/server/scripts/migrations/peertube-8.3.tsindex 0c5309f8bd..b7312f0c28 100644--- a/server/scripts/migrations/peertube-8.3.ts+++ b/server/scripts/migrations/peertube-8.3.ts@@ -27,8 +27,7 @@ async function fillVideoSearchTable () {INSERT INTO "videoSearch" ("videoId", "searchVector")SELECT "id", video_search_vector(name, description)FROM "video"- ON CONFLICT ("videoId") DO UPDATE SET- "searchVector" = EXCLUDED."searchVector"+ ON CONFLICT ("videoId") DO NOTHING`)console.log('videoSearch table filled.\n')@@ -60,7 +59,8 @@ async function migrateVideoInfohashes () {await sequelizeTypescript.query(`INSERT INTO "videoInfohash" ("infohash", "videoFileId") ` +- `SELECT safe_decode_hex("infoHash"), "id" FROM "videoFile" WHERE "infoHash" IS NOT NULL AND safe_decode_hex("infoHash") IS NOT NULL`+ `SELECT safe_decode_hex("infoHash"), "id" FROM "videoFile" WHERE "infoHash" IS NOT NULL AND safe_decode_hex("infoHash") IS NOT NULL ` ++ `ON CONFLICT DO NOTHING`)await sequelizeTypescript.query(`DROP FUNCTION safe_decode_hex(text);`)