diff options
author | 2021-08-05 14:31:39 +0530 | |
---|---|---|
committer | 2021-08-05 14:31:39 +0530 | |
commit | 79f7ace89ab706c128745a23468f7c580540db72 (patch) | |
tree | f0c1fc79d0bb6a6ec52f4eedb89ec59946b67c33 /src/internal-server/start/migrate.js | |
parent | refactor: general code improvements (diff) | |
download | ferdium-app-79f7ace89ab706c128745a23468f7c580540db72.tar.gz ferdium-app-79f7ace89ab706c128745a23468f7c580540db72.tar.zst ferdium-app-79f7ace89ab706c128745a23468f7c580540db72.zip |
revert: partially reverts the previous change to fix issue that the packaged app doesn't start up
Diffstat (limited to 'src/internal-server/start/migrate.js')
-rw-r--r-- | src/internal-server/start/migrate.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/internal-server/start/migrate.js b/src/internal-server/start/migrate.js index 6846beef6..c27e07bc5 100644 --- a/src/internal-server/start/migrate.js +++ b/src/internal-server/start/migrate.js | |||
@@ -1,3 +1,5 @@ | |||
1 | const { ferdiVersion } = require('../../environment'); | ||
2 | |||
1 | /** | 3 | /** |
2 | * Migrate server database to work with current Ferdi version | 4 | * Migrate server database to work with current Ferdi version |
3 | */ | 5 | */ |
@@ -25,16 +27,16 @@ module.exports = async () => { | |||
25 | settings = typeof user.settings === 'string' ? JSON.parse(user.settings) : user.settings; | 27 | settings = typeof user.settings === 'string' ? JSON.parse(user.settings) : user.settings; |
26 | } | 28 | } |
27 | 29 | ||
28 | if (!settings || !settings.db_version || settings.db_version !== process.env.FERDI_VERSION) { | 30 | if (!settings || !settings.db_version || settings.db_version !== ferdiVersion) { |
29 | const srcVersion = settings && settings.db_version ? settings.db_version : '5.4.0-beta.2'; | 31 | const srcVersion = settings && settings.db_version ? settings.db_version : '5.4.0-beta.2'; |
30 | migrateLog(`🔮 Migrating table from ${srcVersion} to ${process.env.FERDI_VERSION}`); | 32 | migrateLog(`🔮 Migrating table from ${srcVersion} to ${ferdiVersion}`); |
31 | 33 | ||
32 | // Migrate database to current Ferdi version | 34 | // Migrate database to current Ferdi version |
33 | // Currently no migrations | 35 | // Currently no migrations |
34 | 36 | ||
35 | // Update version number in database | 37 | // Update version number in database |
36 | if (!settings) settings = {}; | 38 | if (!settings) settings = {}; |
37 | settings.db_version = process.env.FERDI_VERSION; | 39 | settings.db_version = ferdiVersion; |
38 | const newUser = await User.find(1); // Fetch user again as we might have only just created it | 40 | const newUser = await User.find(1); // Fetch user again as we might have only just created it |
39 | newUser.settings = JSON.stringify(settings); | 41 | newUser.settings = JSON.stringify(settings); |
40 | await newUser.save(); | 42 | await newUser.save(); |