]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/initializers/migrator.ts
Add ability to search video channels
[github/Chocobozzz/PeerTube.git] / server / initializers / migrator.ts
index 9ebc57f0764d3caf631b3433af60f315ae68c536..539e2bc8fbaeb17a6ba52af3334db7296086fb6e 100644 (file)
@@ -11,19 +11,11 @@ async function migrate () {
   // The installer will do that
   if (tables.length === 0) return
 
-  let actualVersion: number = null
+  let actualVersion: number | null = null
 
-  // Search in "Applications" or "application" tables
-  try {
-    const [ rows ] = await sequelizeTypescript.query('SELECT "migrationVersion" FROM "Applications"')
-    if (rows && rows[ 0 ] && rows[ 0 ].migrationVersion) {
-      actualVersion = rows[ 0 ].migrationVersion
-    }
-  } catch {
-    const [ rows ] = await sequelizeTypescript.query('SELECT "migrationVersion" FROM "application"')
-    if (rows && rows[0] && rows[0].migrationVersion) {
-      actualVersion = rows[0].migrationVersion
-    }
+  const [ rows ] = await sequelizeTypescript.query('SELECT "migrationVersion" FROM "application"')
+  if (rows && rows[0] && rows[0].migrationVersion) {
+    actualVersion = rows[0].migrationVersion
   }
 
   if (actualVersion === null) {
@@ -43,7 +35,7 @@ async function migrate () {
     try {
       await executeMigration(actualVersion, migrationScript)
     } catch (err) {
-      logger.error('Cannot execute migration %s.', migrationScript.version, err)
+      logger.error('Cannot execute migration %s.', migrationScript.version, { err })
       process.exit(-1)
     }
   }