Migrations in multiples context (ORA-00955)

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
josue.agnese
Posts: 7
Joined: Tue 21 Aug 2018 13:56

Migrations in multiples context (ORA-00955)

Post by josue.agnese » Tue 21 Aug 2018 14:15

Hi!

Current Devart Versions:
- Devart.Data.Oracle.EFCore (9.6.570)
- Devart.Data.Oracle (9.6.570)

I my application, I have 4 DbContexts for the same database.

When I run migrations to the first DbContext no problem occurs.
When executing the migrations to the second DbContext it tries to recreate the table of migrations, but it already exists in the database

Code: Select all

Update-Database -Context:OracleRacDbContext -v
Migrating using database '' on server '127.0.0.1/DBO'.
Opening connection to database '' on server '127.0.0.1/DBO'.
Opened connection to database '' on server '127.0.0.1/DBO'.
Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='0']
SELECT COUNT(*)
  FROM SYS.ALL_TABLES
 WHERE (OWNER = SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') AND TABLE_NAME IN ('TNFCLIENTCUSTOMIZATIONS', 'TNFFEATURES', 'TNFORGANIZATIONTREETABLE', 'TNFORGANIZATIONUNITS', 'TNFPERMISSIONS', 'TNFPRODUCTS', 'TNFROLES', 'TNFROLECLAIMS', 'TNFTENANTS', 'TNFTENANTPRODUCTS', 'TNFUSERS', 'TNFUSERACCOUNTS', 'TNFUSERCLAIMS', 'TNFUSERLOGINS', 'TNFUSERLOGINATTEMPTS', 'TNFUSERORGANIZATIONUNITS', 'TNFUSERROLES', 'TNFUSERTOKENS'))
Executed DbCommand (103ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
SELECT COUNT(*)
  FROM SYS.ALL_TABLES
 WHERE (OWNER = SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') AND TABLE_NAME IN ('TNFCLIENTCUSTOMIZATIONS', 'TNFFEATURES', 'TNFORGANIZATIONTREETABLE', 'TNFORGANIZATIONUNITS', 'TNFPERMISSIONS', 'TNFPRODUCTS', 'TNFROLES', 'TNFROLECLAIMS', 'TNFTENANTS', 'TNFTENANTPRODUCTS', 'TNFUSERS', 'TNFUSERACCOUNTS', 'TNFUSERCLAIMS', 'TNFUSERLOGINS', 'TNFUSERLOGINATTEMPTS', 'TNFUSERORGANIZATIONUNITS', 'TNFUSERROLES', 'TNFUSERTOKENS'))
Closing connection to database '' on server '127.0.0.1/DBO'.
Closed connection to database '' on server '127.0.0.1/DBO'.
DetectChanges starting for 'OracleRacDbContext'.
DetectChanges completed for 'OracleRacDbContext'.
Opening connection to database '' on server '127.0.0.1/DBO'.
Opened connection to database '' on server '127.0.0.1/DBO'.
Executing DbCommand [Parameters=[], CommandType='Text', CommandTimeout='0']
CREATE TABLE EFMigrationsHistory__ ( 
  MigrationId NVARCHAR2(150) NOT NULL,
  ProductVersion NVARCHAR2(32) NOT NULL,
  PRIMARY KEY (MigrationId)
)
Failed executing DbCommand (8ms) [Parameters=[], CommandType='Text', CommandTimeout='0']
CREATE TABLE EFMigrationsHistory__ ( 
  MigrationId NVARCHAR2(150) NOT NULL,
  ProductVersion NVARCHAR2(32) NOT NULL,
  PRIMARY KEY (MigrationId)
)
Closing connection to database '' on server '127.0.0.1/DBO'.
Closed connection to database '' on server '127.0.0.1/DBO'.
'OracleRacDbContext' disposed.
Devart.Data.Oracle.OracleException (0x80004005): ORA-00955: name is already used by an existing object
   at   .      ()
   at   .()
   at   .      ()
   at   .(   , Int32 )
   at   .      (Int32 ,    )
   at Devart.Data.Oracle.OracleCommand.InternalExecute(CommandBehavior behavior, IDisposable disposable, Int32 startRecord, Int32 maxRecords, Boolean nonQuery)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
   at Devart.Data.Oracle.OracleCommand.ExecuteNonQuery()
   at   .ExecuteNonQuery()
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.Execute(IRelationalConnection connection, DbCommandMethod executeMethod, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Storage.Internal.RelationalCommand.ExecuteNonQuery(IRelationalConnection connection, IReadOnlyDictionary`2 parameterValues)
   at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
ORA-00955: name is already used by an existing object

Shalex
Site Admin
Posts: 8609
Joined: Thu 14 Aug 2008 12:44

Re: Migrations in multiples context (ORA-00955)

Post by Shalex » Mon 27 Aug 2018 18:49

We will investigate the issue and notify you about the result.

Shalex
Site Admin
Posts: 8609
Joined: Thu 14 Aug 2008 12:44

Re: Migrations in multiples context (ORA-00955)

Post by Shalex » Tue 28 Aug 2018 14:10

We have reproduced the problem and are investigating it. We will notify you when the issue is fixed.

Shalex
Site Admin
Posts: 8609
Joined: Thu 14 Aug 2008 12:44

Re: Migrations in multiples context (ORA-00955)

Post by Shalex » Thu 20 Sep 2018 15:11

The bug with creating database objects in the same schema by several EF Core contexts in Code-First approach is fixed: viewtopic.php?f=1&t=37715.

Post Reply