Skip to content

Commit

Permalink
Merge pull request #303 from Mashape/hotfix/auto-migrations
Browse files Browse the repository at this point in the history
[fix/migrations] enabling auto migrations on start

Former-commit-id: ab191325d85154a39c2831467d934083ed885f4d
  • Loading branch information
thibaultcha committed Jun 6, 2015
2 parents 2325a8c + cba545c commit 126a483
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions kong/cli/utils/signal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,16 @@ local function prepare_database(args_config)
cutils.logger:error_exit(err)
elseif keyspace == nil then
cutils.logger:info("Database not initialized. Running migrations...")
local migrations = require("kong.tools.migrations")(dao_factory, cutils.get_luarocks_install_dir())
migrations:migrate(function(migration, err)
if err then
cutils.logger:error_exit(err)
elseif migration then
cutils.logger:success("Migrated up to: "..cutils.colors.yellow(migration.name))
end
end)
end

local migrations = require("kong.tools.migrations")(dao_factory, cutils.get_luarocks_install_dir())
migrations:migrate(function(migration, err)
if err then
cutils.logger:error_exit(err)
elseif migration then
cutils.logger:success("Migrated up to: "..cutils.colors.yellow(migration.name))
end
end)
end

local function stop_dnsmasq(kong_config)
Expand Down

0 comments on commit 126a483

Please sign in to comment.