diff options
author | Chocobozzz <me@florianbigard.com> | 2018-01-29 11:58:07 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-01-29 11:58:07 +0100 |
commit | 4805cff179cbf518abb4c1b494b477c71f84b989 (patch) | |
tree | e5b510f874418a540f853e0f6e878fc2b1ee8035 | |
parent | 93bd24a97dd6115d66833b59f6a82c248c6a5195 (diff) | |
download | PeerTube-4805cff179cbf518abb4c1b494b477c71f84b989.tar.gz PeerTube-4805cff179cbf518abb4c1b494b477c71f84b989.tar.zst PeerTube-4805cff179cbf518abb4c1b494b477c71f84b989.zip |
Fix migrations
-rwxr-xr-x | scripts/release.sh | 1 | ||||
-rw-r--r-- | server/initializers/constants.ts | 2 | ||||
-rw-r--r-- | server/initializers/migrations/0190-video-comment-unique-url.ts | 23 | ||||
-rw-r--r-- | support/doc/production.md | 21 |
4 files changed, 35 insertions, 12 deletions
diff --git a/scripts/release.sh b/scripts/release.sh index 0a78fe990..0e288a49c 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 | |||
53 | "$directory_name/dist" "$directory_name/package.json" \ | 53 | "$directory_name/dist" "$directory_name/package.json" \ |
54 | "$directory_name/scripts" "$directory_name/support" \ | 54 | "$directory_name/scripts" "$directory_name/support" \ |
55 | "$directory_name/tsconfig.json" "$directory_name/yarn.lock" \ | 55 | "$directory_name/tsconfig.json" "$directory_name/yarn.lock" \ |
56 | "$directory_name/server/" "$directory_name/shared/" \ | ||
57 | || exit -1 | 56 | || exit -1 |
58 | rm "$directory_name" || exit -1 | 57 | rm "$directory_name" || exit -1 |
59 | 58 | ||
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts index a88f9642c..03828f54f 100644 --- a/server/initializers/constants.ts +++ b/server/initializers/constants.ts | |||
@@ -12,7 +12,7 @@ let config: IConfig = require('config') | |||
12 | 12 | ||
13 | // --------------------------------------------------------------------------- | 13 | // --------------------------------------------------------------------------- |
14 | 14 | ||
15 | const LAST_MIGRATION_VERSION = 185 | 15 | const LAST_MIGRATION_VERSION = 190 |
16 | 16 | ||
17 | // --------------------------------------------------------------------------- | 17 | // --------------------------------------------------------------------------- |
18 | 18 | ||
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 000000000..b196c9352 --- /dev/null +++ b/server/initializers/migrations/0190-video-comment-unique-url.ts | |||
@@ -0,0 +1,23 @@ | |||
1 | import * as Sequelize from 'sequelize' | ||
2 | |||
3 | async function up (utils: { | ||
4 | transaction: Sequelize.Transaction, | ||
5 | queryInterface: Sequelize.QueryInterface, | ||
6 | sequelize: Sequelize.Sequelize | ||
7 | }): Promise<void> { | ||
8 | { | ||
9 | const query = 'DELETE FROM "videoComment" s1 ' + | ||
10 | 'USING (SELECT MIN(id) as id, url FROM "videoComment" GROUP BY "url" HAVING COUNT(*) > 1) s2 ' + | ||
11 | 'WHERE s1."url" = s2."url" AND s1.id <> s2.id' | ||
12 | await utils.sequelize.query(query) | ||
13 | } | ||
14 | } | ||
15 | |||
16 | function down (options) { | ||
17 | throw new Error('Not implemented.') | ||
18 | } | ||
19 | |||
20 | export { | ||
21 | up, | ||
22 | down | ||
23 | } | ||
diff --git a/support/doc/production.md b/support/doc/production.md index 56d00bf56..6bf6c1ca3 100644 --- a/support/doc/production.md +++ b/support/doc/production.md | |||
@@ -280,28 +280,29 @@ $ cd /var/www/peertube/versions && \ | |||
280 | sudo -u peertube rm peertube-${VERSION}.zip | 280 | sudo -u peertube rm peertube-${VERSION}.zip |
281 | ``` | 281 | ``` |
282 | 282 | ||
283 | Change the link to point to the latest version: | 283 | Install node dependencies: |
284 | 284 | ||
285 | ``` | 285 | ``` |
286 | $ cd /var/www/peertube && \ | 286 | $ cd /var/www/peertube/versions/peertube-${VERSION} && \ |
287 | sudo rm ./peertube-latest && \ | 287 | sudo -u peertube yarn install --production --pure-lockfile |
288 | sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest | ||
289 | ``` | 288 | ``` |
290 | 289 | ||
291 | Install node dependencies: | 290 | Copy new configuration defaults values and update your configuration file: |
292 | 291 | ||
293 | ``` | 292 | ``` |
294 | $ cd /var/www/peertube/peertube-latest && \ | 293 | $ sudo -u peertube cp /var/www/peertube/versions/peertube-${VERSION}/config/default.yaml /var/www/peertube/config/default.yaml |
295 | sudo -u peertube yarn install --production --pure-lockfile | 294 | $ diff /var/www/peertube/versions/peertube-${VERSION}/config//production.yaml.example /var/www/peertube/config/production.yaml |
296 | ``` | 295 | ``` |
297 | 296 | ||
298 | Copy new configuration defaults values and update your configuration file: | 297 | Change the link to point to the latest version: |
299 | 298 | ||
300 | ``` | 299 | ``` |
301 | $ sudo -u peertube cp /var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml | 300 | $ cd /var/www/peertube && \ |
302 | $ diff /var/www/peertube/peertube-latest/config//production.yaml.example /var/www/peertube/config/production.yaml | 301 | sudo rm ./peertube-latest && \ |
302 | sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest | ||
303 | ``` | 303 | ``` |
304 | 304 | ||
305 | |||
305 | Restart PeerTube: | 306 | Restart PeerTube: |
306 | ``` | 307 | ``` |
307 | $ sudo systemctl restart peertube | 308 | $ sudo systemctl restart peertube |