Skip to content

Commit

Permalink
hotfix(dao) make 'run_migrations()' only return strings
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Sep 8, 2016
1 parent 86b7fa9 commit 3bd2356
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kong/dao/factory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,16 @@ function Factory:run_migrations(on_migrate, on_success)

local migrations_modules = self:migrations_modules()
local cur_migrations, err = self:current_migrations()
if err then return DAO.ret_error(_db.db_type, nil, err) end
if err then return nil, tostring(DAO.ret_error(_db.db_type, nil, err)) end

local ok, err = migrate(self, "core", migrations_modules, cur_migrations, on_migrate, on_success)
if not ok then return DAO.ret_error(_db.db_type, nil, tostring(err)) end
if not ok then return nil, tostring(DAO.ret_error(_db.db_type, nil, err)) end

local migrations_ran = 0
for identifier in pairs(migrations_modules) do
if identifier ~= "core" then
local ok, err, n_ran = migrate(self, identifier, migrations_modules, cur_migrations, on_migrate, on_success)
if not ok then return DAO.ret_error(_db.db_type, nil, tostring(err))
if not ok then return nil, tostring(DAO.ret_error(_db.db_type, nil, err))
else
migrations_ran = math.max(migrations_ran, n_ran)
end
Expand Down

0 comments on commit 3bd2356

Please sign in to comment.