I want to drop a column from the database without redeploying the application at the same time.
I am using JOOQ generated files for the table and I have removed all usage of the field from the code, so no 'get' or 'set' of the field, but when records are fetched, the field is still in the query. So if I drop the column the code will break.
I am thinking about editing the JOOQ generated files, but unsure if this will even work as the fields seems to be numbered in there (maybe based on their index in the table).
/**
* Setter for <code>database.person.email</code>.
*/
public void setEmail(String value) {
set(7, value);
}
/**
* Getter for <code>database.person.email</code>.
*/
public String getEmail() {
return (String) get(7);
}
You seem to be using selectFrom(Table)
. It will always produce an explicit column list from Table.fields()
in the SELECT
clause, if the column list is known to jOOQ. This should probably be better documented.
The consequence of this behaviour (as opposed to generating SELECT *
) is that:
Ideally, however, you should always use an explicit column list in your projection, not project all the columns, unless you need the majority of them anyway. This will not only prevent this issue form happening most of the times, it will also benefit performance in various ways.
I am thinking about editing the JOOQ generated files, but unsure if this will even work as the fields seems to be numbered in there (maybe based on their index in the table).
If editing those files is an option, then re-generation and re-deployment is probably an option as well. I recommend not to edit those files manually. If you must, then make sure to edit both generated Table
and TableRecord
classes, and adapt all column indexes.