Fix migrations
This commit is contained in:
parent
93bd24a97d
commit
4805cff179
|
@ -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/dist" "$directory_name/package.json" \
|
||||||
"$directory_name/scripts" "$directory_name/support" \
|
"$directory_name/scripts" "$directory_name/support" \
|
||||||
"$directory_name/tsconfig.json" "$directory_name/yarn.lock" \
|
"$directory_name/tsconfig.json" "$directory_name/yarn.lock" \
|
||||||
"$directory_name/server/" "$directory_name/shared/" \
|
|
||||||
|| exit -1
|
|| exit -1
|
||||||
rm "$directory_name" || exit -1
|
rm "$directory_name" || exit -1
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ let config: IConfig = require('config')
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const LAST_MIGRATION_VERSION = 185
|
const LAST_MIGRATION_VERSION = 190
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
|
@ -280,6 +280,20 @@ $ cd /var/www/peertube/versions && \
|
||||||
sudo -u peertube rm peertube-${VERSION}.zip
|
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:
|
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
|
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:
|
Restart PeerTube:
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue