chore: move database migration script
This commit is contained in:
parent
ab211c8a9e
commit
abd7a1ca2e
|
@ -6,7 +6,7 @@ For starters we recommend cloning the new version somewhere else instead of `git
|
||||||
- Then copy your `database/db` file from your v3 folder to the root of your v4 folder.
|
- Then copy your `database/db` file from your v3 folder to the root of your v4 folder.
|
||||||
- Make sure to install the dependencies by running `npm i`
|
- Make sure to install the dependencies by running `npm i`
|
||||||
- You then need to run `npm run setup` from the v4 folder and finish the setup process.
|
- You then need to run `npm run setup` from the v4 folder and finish the setup process.
|
||||||
- Once that's done you need to manually run `node src/api/databaseMigration.js` from the root folder of v4.
|
- Once that's done you need to manually run `node src/api/scripts/databaseMigration.js` from the root folder of v4.
|
||||||
- This will migrate the v3 database to v4 and regenerate every single thumbnail in webp to save bandwidth.
|
- This will migrate the v3 database to v4 and regenerate every single thumbnail in webp to save bandwidth.
|
||||||
- After the migration finishes, the last step is to update your nginx config with the [newly provided script](./nginx.md).
|
- After the migration finishes, the last step is to update your nginx config with the [newly provided script](./nginx.md).
|
||||||
- Restart nginx with `sudo nginx -s reload`.
|
- Restart nginx with `sudo nginx -s reload`.
|
||||||
|
|
|
@ -3,7 +3,7 @@ require('dotenv').config();
|
||||||
const nodePath = require('path');
|
const nodePath = require('path');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
const jetpack = require('fs-jetpack');
|
const jetpack = require('fs-jetpack');
|
||||||
const ThumbUtil = require('./utils/ThumbUtil');
|
const ThumbUtil = require('../utils/ThumbUtil');
|
||||||
|
|
||||||
const oldDb = require('knex')({
|
const oldDb = require('knex')({
|
||||||
client: 'sqlite3',
|
client: 'sqlite3',
|
||||||
|
@ -19,12 +19,7 @@ const newDb = require('knex')({
|
||||||
filename: nodePath.join(__dirname, '../../database/', 'database.sqlite')
|
filename: nodePath.join(__dirname, '../../database/', 'database.sqlite')
|
||||||
},
|
},
|
||||||
postProcessResponse: result => {
|
postProcessResponse: result => {
|
||||||
const booleanFields = [
|
const booleanFields = ['enabled', 'enableDownload', 'isAdmin', 'nsfw', 'generateZips', 'publicMode', 'userAccounts'];
|
||||||
'enabled',
|
|
||||||
'enableDownload',
|
|
||||||
'isAdmin',
|
|
||||||
'nsfw'
|
|
||||||
];
|
|
||||||
|
|
||||||
const processResponse = row => {
|
const processResponse = row => {
|
||||||
Object.keys(row).forEach(key => {
|
Object.keys(row).forEach(key => {
|
Loading…
Reference in New Issue