Kong migrations for custom Kong plugin

I am running Kong 0.11.2 and cannot seem to get migrations to work for a custom Kong plugin that I have written.

I created a migrations directory and added a postgres.lua file since Postgres is what I use.

I am simply wanting to update config options for the custom plugin. When I run the migrations command kong migrations up, it says everything is up to date.

However, when I go to start Kong again, I get this error:

Error: /usr/local/share/lua/5.1/kong/cmd/start.lua:51: 2018/02/19 21:12:19 [warn] postgres database 'kingkong' is missing migration: (custom-kong-analytics) 2018-02-19-001-change-to-mysql nginx: [error] init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:149: [postgres error] the current database schema does not match this version of Kong. Please run `kong migrations up` to update/initialize the database schema. Be aware that Kong migrations should only run from a single node, and that nodes running migrations concurrently will conflict with each other and might corrupt your database schema!

Any ideas on what I can do or might be doing wrong? Documentation is lacking in this department.

Thanks!

Hi,

It’s possible that that kong is using different configuration files when doing kong start and when doing kong migrations up. Are you passing the config file with -c when migrating, the same way that you pass it when starting Kong?

I am starting Kong and running the migrations file with the exact same config file. Otherwise, I will get an error that Kong can’t connect to the database.