I have a requirement of working with multiple databases depending on the client, some use SQL Server, some Oracle, and it'd be nice to support PostgreSQL too. Also, this application is supposed to grow quite large.
Specifically, I've created a new project using ABP with EF Core 2.2.4.
Running Update-Database
worked alright both for SQL Server and PostgreSQL, but for Oracle it gives me this error:
PM> Update-Database
Applying migration '20180726102703_Upgrade_ABP_3.8.0'.
2019-09-18 10:16:42.088928 ThreadID:1 (ERROR) OracleRelationalCommand.Execute() : Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-01442: a coluna a ser modificada para NOT NULL já é NOT NULL at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone) at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, Boolean isFromEF) at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery() at Oracle.EntityFrameworkCore.Storage.Internal.OracleRelationalCommandBuilderFactory.OracleRelationalCommandBuilder.OracleRelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues) Failed executing DbCommand (121ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
ALTER TABLE "AbpUsers" MODIFY "UserName" NVARCHAR2(256) NOT NULL
In English:
ORA-01442: column to be modified to NOT NULL is already NOT NULL
Here is the relevant code for 20180726102703_Upgrade_ABP_3.8.0:
public partial class Upgrade_ABP_380 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "UserName",
table: "AbpUsers",
maxLength: 256,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 32);
As you can see, this is the standard code from ABP, and only changes the length of the column, but the generated SQL code contains NOT NULL
, which just Oracle doesn't accept.
Does anyone know a solution or workaround for this problem?
User contributions licensed under CC BY-SA 3.0