#6114·knex

Overwriting nullable option on column fails for OracleDB

Author: jaadsCreated Aug 21, 2024Updated Sep 23, 2026
LabelsNG_bug

Environment

Knex version: 3.1.0 Database + version: OracleDB 19 OS: any

@atiertant

Bug

In the docs it's stated that when updating the nullable option for a column, one would need to provide the default value as well, otherwise the previous default value gets removed, see https://knexjs.org/guide/schema-builder.html#alter.

Although it's not stated in the docs, it seems that this is also the case when updating the default value. Then one would need to provide notNullable() or nullable() , otherwise the it's always get reset to nullable.

With this knowledge it works fine updating the nullable option and the default value independently. However it does not work for OracleDB. When trying to update a column with the same nullable option - the errors:

ERROR: alter table "xxx" modify "indexedcol" varchar2(255) default null not null - ORA-01442: column to be modified to NOT NULL is already NOT NULL