Remove any leftover knex migrations locks before running migrations

Closes #598
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
This commit is contained in:
Pablo Carranza Velez 2018-03-21 09:25:45 -03:00
parent a2f0cacf19
commit c8d79c3b7d

View File

@ -13,7 +13,10 @@ module.exports = class DB
) )
init: => init: =>
@knex.migrate.latest(directory: path.join(__dirname, 'migrations')) @knex('knex_migrations_lock').update({ is_locked: 0 })
.catch(->) # Knex doesn't return a bluebird promise here so we can't catchReturn :(
.then =>
@knex.migrate.latest(directory: path.join(__dirname, 'migrations'))
# Returns a knex object for one of the models (tables) # Returns a knex object for one of the models (tables)
models: (modelName) => models: (modelName) =>