You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The sample code on the Migration file syntax page of Storing Custom Entities is problematic in two ways
The way the END for DO is written is incorrect.
The assert parentheses are not completed, resulting in an error.
assert(connector:query([[
...
]])
END;
$$;
What did you expect to happen?
I confirmed that the following code would work.
postgres = {
up = [[
DO $$
BEGIN
ALTER TABLE IF EXISTS ONLY "my_plugin_table" ADD "cache_key" TEXT UNIQUE;
EXCEPTION WHEN DUPLICATE_COLUMN THEN
-- Do nothing, accept existing state
END$$;
]],
teardown = function(connector, helpers)
assert(connector:connect_migrations())
assert(connector:query([[
DO $$
BEGIN
ALTER TABLE IF EXISTS ONLY "my_plugin_table" DROP "col1";
EXCEPTION WHEN UNDEFINED_COLUMN THEN
-- Do nothing, accept existing state
END$$;
]]))
end,
}
Code of Conduct and Community Expectations
I agree to follow this project's Code of Conduct
I agree to abide by the Community Expectations
The text was updated successfully, but these errors were encountered:
Where is the problem?
https://docs.konghq.com/gateway/latest/plugin-development/custom-entities/#migration-file-syntax
What happened?
The sample code on the Migration file syntax page of Storing Custom Entities is problematic in two ways
What did you expect to happen?
I confirmed that the following code would work.
Code of Conduct and Community Expectations
The text was updated successfully, but these errors were encountered: