Skip to content

Commit

Permalink
Fix migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Jan 29, 2018
1 parent 93bd24a commit 4805cff
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
1 change: 0 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion server/initializers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let config: IConfig = require('config')

// ---------------------------------------------------------------------------

const LAST_MIGRATION_VERSION = 185
const LAST_MIGRATION_VERSION = 190

// ---------------------------------------------------------------------------

Expand Down
23 changes: 23 additions & 0 deletions server/initializers/migrations/0190-video-comment-unique-url.ts
Original file line number Diff line number Diff line change
@@ -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
}
21 changes: 11 additions & 10 deletions support/doc/production.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4805cff

Please sign in to comment.