We are using EF Core Code-First migrations using Devart.Data.Oracle as our provider.
We ran into an issue where a "string" column had been initially created as a CLOB-column in the database, which was expected, as we did not supply a max-length.
Afterwards, we realized that an initially placed "[Required]" DataAnnotation was no longer relevant, and we now wish for the column to be nullable.
This operation should always be safe and I denote that I have executed the following statement successfully.
Code: Select all
ALTER TABLE SCHEMA.A_TEST_TABLE MODIFY (DESCRIPTION NULL);
https://blog.devart.com/entity-framewor ... html#note2
The part where you write "because it is impossible to determine whether the user wants to change data type" sounds a bit over the top, doesn't it?Modifying Columns
Oracle has a set of limitations on column modification operations. It is not allowed to modify data type for CLOB/NCLOB/BLOB columns even for an empty table. It is also not allowed to specify the NOT NULL constraint for a column that already has one, and to specify that the column is nullable if it is already nullable. We have made a workaround for the the latter limitation by generating more complex DDL, however there is no workaround for the LOB column modification limitation because it is impossible to determine whether the user wants to change data type. That’s why any ALTER’s for LOB columns are not allowed by default.
Looking at the MigrationBuilder method-call, it looks like this:
Code: Select all
migrationBuilder.AlterColumn<string>(
name: "DESCRIPTION",
table: "A_TEST_TABLE",
nullable: false,
oldClrType: typeof(string),
oldNullable: true);
Thank you.