Fix migrations

pull/267/head
Chocobozzz 2018-01-29 11:58:07 +01:00
parent 93bd24a97d
commit 4805cff179
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
4 changed files with 38 additions and 15 deletions

View File

@ -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

View File

@ -12,7 +12,7 @@ let config: IConfig = require('config')
// ---------------------------------------------------------------------------
const LAST_MIGRATION_VERSION = 185
const LAST_MIGRATION_VERSION = 190
// ---------------------------------------------------------------------------

View File

@ -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
}

View File

@ -280,6 +280,20 @@ $ cd /var/www/peertube/versions && \
sudo -u peertube rm peertube-${VERSION}.zip
```
Install node dependencies:
```
$ cd /var/www/peertube/versions/peertube-${VERSION} && \
sudo -u peertube yarn install --production --pure-lockfile
```
Copy new configuration defaults values and update your configuration file:
```
$ 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
```
Change the link to point to the latest version:
```
@ -288,19 +302,6 @@ $ cd /var/www/peertube && \
sudo -u peertube ln -s versions/peertube-${VERSION} ./peertube-latest
```
Install node dependencies:
```
$ cd /var/www/peertube/peertube-latest && \
sudo -u peertube yarn install --production --pure-lockfile
```
Copy new configuration defaults values and update your configuration file:
```
$ 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
```
Restart PeerTube:
```