Migration '001_14_to_15' error when kong migrations bootstrap on kong 1.0.0


#1

Hi,

On redhat i have the following error

I made a first command :
kong migrations bootstrap

which works well when i start kong with
kong start

I have an error with the following message :

database needs bootstrapping; run ‘kong migrations bootstrap’
Error: /usr/local/share/lua/5.1/kong/cmd/start.lua:46: nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:281: database needs bootstrap; run ‘kong migrations bootstrap’
stack traceback:
[C]: in function ‘error’
/usr/local/share/lua/5.1/kong/init.lua:281: in function ‘init’
init_by_lua:3: in main chunk

If i re-run kong migrations bootstrap i have following message :

bootstrapping database…
migrating core on database ‘kongu1’…
core migrated up to: 000_base (executed)
core migrated up to: 001_14_to_15 (executed)
core migrated up to: 002_15_to_1 (executed)
migrating oauth2 on database ‘xxxxxx’…
oauth2 migrated up to: 000_base_oauth2 (executed)
Error: [PostgreSQL error] cluster_mutex callback threw an error: /usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:68: [PostgreSQL error] failed to run migration ‘001_14_to_15’ up: ERROR: column “api_id” does not exist
stack traceback:
[C]: in function ‘assert’
/usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:68: in function </usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:67>
[C]: in function ‘xpcall’
/usr/local/share/lua/5.1/kong/db/init.lua:390: in function ‘cluster_mutex’
/usr/local/share/lua/5.1/kong/cmd/utils/migrations.lua:67: in function ‘bootstrap’
/usr/local/share/lua/5.1/kong/cmd/migrations.lua:114: in function ‘cmd_exec’
/usr/local/share/lua/5.1/kong/cmd/init.lua:87: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:87>
[C]: in function ‘xpcall’
/usr/local/share/lua/5.1/kong/cmd/init.lua:87: in function </usr/local/share/lua/5.1/kong/cmd/init.lua:44>
/usr/local/bin/kong:7: in function ‘file_gen’
init_worker_by_lua:47: in function <init_worker_by_lua:45>
[C]: in function ‘xpcall’
init_worker_by_lua:54: in function <init_worker_by_lua:52>

I install from redhat rpm with postgres 9.6


#2

I have found the problem:
this request don’t return any row when your user has not the default table_schema :

select table_name from information_schema.tables where table_schema = ‘public’;

line 33 : db/strategies/postgres/connector.lua
change table_schema by the good one.