diff --git a/server/Database.js b/server/Database.js index 27f84a88..6e8e35fd 100644 --- a/server/Database.js +++ b/server/Database.js @@ -80,7 +80,7 @@ class Database { require('./models/Notification')(this.sequelize) require('./models/UserPermission')(this.sequelize) - return this.sequelize.sync({ force: false }) + return this.sequelize.sync({ force: true }) } async createTestUser() { diff --git a/server/Server.js b/server/Server.js index e6cd5316..81109b5b 100644 --- a/server/Server.js +++ b/server/Server.js @@ -103,8 +103,8 @@ class Server { // TODO: Test new db connection await Database.init() - await Database.createTestUser() - // await dbMigration3.migrate() + // await Database.createTestUser() + await dbMigration3.migrate() const previousVersion = await this.db.checkPreviousVersion() // Returns null if same server version if (previousVersion) { diff --git a/server/utils/migrations/dbMigration.js b/server/utils/migrations/dbMigration.js index 4825cbbb..143992e8 100644 --- a/server/utils/migrations/dbMigration.js +++ b/server/utils/migrations/dbMigration.js @@ -178,11 +178,15 @@ async function migrateUsers(oldUsers) { } module.exports.migrate = async () => { - Logger.info(`[dbMigration3] Starting migration`) + Logger.info(`[dbMigration] Starting migration`) const data = await oldDbFiles.init() + const start = Date.now() await migrateLibraries(data.libraries) - await migrateLibraryItems(data.libraryItems.slice(0, 10)) + await migrateLibraryItems(data.libraryItems) await migrateUsers(data.users) + const elapsed = Date.now() - start + + Logger.info(`[dbMigration] Migration complete. Elapsed ${Math.round(elapsed / 1000)}s`) } \ No newline at end of file