Skip to content

Commit

Permalink
Remove any leftover knex migrations locks before running migrations
Browse files Browse the repository at this point in the history
Closes #598
Change-Type: patch
Signed-off-by: Pablo Carranza Velez <pablo@resin.io>
  • Loading branch information
Pablo Carranza Velez committed Mar 21, 2018
1 parent a2f0cac commit 86803c6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/db.coffee
Expand Up @@ -13,7 +13,10 @@ module.exports = class DB
)

init: =>
@knex.migrate.latest(directory: path.join(__dirname, 'migrations'))
@knex('knex_migrations_lock').update({ is_locked: 0 })
.catchReturn()
.then =>
@knex.migrate.latest(directory: path.join(__dirname, 'migrations'))

# Returns a knex object for one of the models (tables)
models: (modelName) =>
Expand Down

0 comments on commit 86803c6

Please sign in to comment.