Auto-merge for PR #599 via VersionBot

Remove any leftover knex migrations locks before running migrations
This commit is contained in:
resin-io-versionbot[bot] 2018-03-22 14:56:46 +00:00 committed by GitHub
commit 11e8899455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY! automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/). This project adheres to [Semantic Versioning](http://semver.org/).
## v7.1.19 - 2018-03-22
* Remove any leftover knex migrations locks before running migrations #599 [Pablo Carranza Velez]
## v7.1.18 - 2018-03-19 ## v7.1.18 - 2018-03-19
* Trim whitespace from the hostname file on the host before passing it as the hostname for containers with host network #595 [Pablo Carranza Velez] * Trim whitespace from the hostname file on the host before passing it as the hostname for containers with host network #595 [Pablo Carranza Velez]

View File

@ -6,5 +6,8 @@ module.exports = {
connection: { connection: {
filename: './database.sqlite' filename: './database.sqlite'
}, },
useNullAsDefault: true useNullAsDefault: true,
migrations: {
directory: './src/migrations'
}
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "resin-supervisor", "name": "resin-supervisor",
"description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.", "description": "This is resin.io's Supervisor, a program that runs on IoT devices and has the task of running user Apps (which are Docker containers), and updating them as Resin's API informs it to.",
"version": "7.1.18", "version": "7.1.19",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -13,6 +13,9 @@ module.exports = class DB
) )
init: => init: =>
@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')) @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)