I’m using the following environment
The scenario is as follows
INSERT INTO pricing_plan (name)
SELECT unnest(ARRAY['Free', 'Paid', 'Paid with free trial or plan'])
EXCEPT
SELECT name FROM pricing_plan;
Since this migration did not modify any schema, jOOQ codegen was not run in the development environment and the migration was deployed to production as-is.
ALTER TABLE "recommend_product" ADD COLUMN "content" VARCHAR(500);
When I ran the jOOQ codegen in development (triggered by this schema change), I encountered the following error
DDLDatabase Error: Your SQL string could not be parsed or interpreted.
...
Table "PRICING_PLAN" not found (candidates are: "pricing_plan"); SQL statement:
insert into PRICING_PLAN (NAME) select null except select NAME from PRICING_PLAN [42103-232]
The root cause appears to be In v0.0.5, I did not quote the table and column names properly. It should have been written as
INSERT INTO "pricing_plan" ("name")
SELECT unnest(ARRAY['Free', 'Paid', 'Paid with free trial or plan'])
EXCEPT
SELECT "name" FROM "pricing_plan";
However, the v0.0.5 migration file has already been deployed in production. As a result, my development environment now has migrations from v0.0.1 through v0.0.6 (with v0.0.5 in its unquoted, faulty form), and jOOQ codegen fails due to the discrepancy in identifier quoting
There's a flag called defaultNameCase
in the DDLDatabase
configuration, see:
You can set it to:
<!-- The default name case for unquoted objects:
- as_is: unquoted object names are kept unquoted
- upper: unquoted object names are turned into upper case (most databases)
- lower: unquoted object names are turned into lower case (e.g. PostgreSQL) -->
<property>
<key>defaultNameCase</key>
<value>lower</value>
</property>