Estimated reading time:
Custom entities and plugins have the following breaking changes for 2.1.x
run_on must be removed from the plugin schema.
select_all has been removed. The recommended fix path is to
iterate all entities using
:each and filter entities in
Lua. This works well for low cardinality (less than 5k
entities). For higher cardinality entities, the recommendation is
to write the queries in custom DAO code. Also, your use cases
might be a good fit for
each_for, that will work
using database indices. Those methods are able to filter by a
foreign key relation.
Workspaceable entities and plugin entities need a migration.
Upgrading custom workspaced entities
Kong 2.1.x will not start if it finds an entity that is marked as workspaceable
but doesn’t comply with the latest data format needed. In that case, a list of
the tables that should be migrated will be printed.
Warning: A migration generated by upgrade-workspace-table
must be tested in a non-production environment with backup data before
running it in production.
kong migrations upgrade-workspace-table [table-name] prints a
temptative migration for an entity. The migration contents should be added as a
new migration for the entity like any other migration.
Any workspaceable entity in 2.1.x must incorporate the following changes:
ws_id field of type UUID, with a foreign key to
- Unique fields do not require
<workspace_name>: prefix, which must be
ws_id field of type UUID
- Unique fields must use
<workspace_id>: as a prefix instead of