Hi !
My CD pipeline has a simple script which responsibility is to ensure that the Kong database is up-to-date before starting the tests. Until version 0.14, this script was very simple: kong migration up
, as this single command was handling the various use cases:
- creation of the schema / from scratch database
- upgrade of the schema from a previous version of Kong
- and in case the database schema is already up to date, nothing is done!
With the new migration framework, my simple scripts is no longer working and I’m trying to adapt it in order to manage the same use case.
Looking to the implementation of the kong migration list
(https://github.com/Kong/kong/blob/master/kong/cmd/migrations.lua#L95), I see some interesting exit codes:
- If
kong migration list
exists with code 0, then everything is up-to-date - If
kong migration list
exists with code 3, then a bootstrapping is required, and I can simply runkong migration bootstrap
(and nothing more is to be done, am I right ? nokong migration finish
) - Then, what is less clear for me is what I should do for the other error codes. I have the following feeling; can you please tell me if I’m right:
– Ifkong migration list
exists with code 4: there are some pending migrations (i.e. thekong migration up
has been run previously) => I need to runkong migration finish
– Ifkong migration list
exists with code 5: there is a need for start the migration => I need to runkong migration up
first, and thenkong migration finish
BTW, one additional question: the migration from 0.14 to 1.0 requires the two steps: up
and then finish
. Will these two steps be also required for any further migrations (from 1.0.x to 1.1, from 1.1 to 1.2, etc) or will we be back to a single kong migration up
?
Thanks a lot for your help.