Error Running Migration Down

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
ndroe
Posts: 18
Joined: Fri 03 Feb 2012 16:08

Error Running Migration Down

Post by ndroe » Tue 23 Oct 2012 14:19

I'm getting the following error when trying to run an empty migration down:

System.Data.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> Devart.Data.Oracle.OracleException: ORA-01460: unimplemented or unreasonable conversion requested
at Devart.Data.Oracle.t.d()
at Devart.Data.Oracle.as.h()
at Devart.Data.Oracle.as.c()
at Devart.Data.Oracle.aa.a(Int32 A_0, bx A_1)
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.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at Devart.Data.Oracle.Entity.w.a(CommandBehavior A_0)
at Devart.Data.Oracle.Entity.w.b(CommandBehavior A_0)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute[TResultType](ObjectContext context, ObjectParameterCollection parameterValues)
at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
at System.Data.Entity.Internal.Linq.InternalQuery`1.GetEnumerator()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at System.Data.Entity.Migrations.History.HistoryRepository.GetMigrationId(String migrationName)
at System.Data.Entity.Migrations.DbMigrator.GetMigrationId(String migration)
at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration)
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()

This problem did not occur in version 7.2.77 but does in 7.2.104. Is there something wrong with my __MigrationHistory table? This table was created with Entity Framework 4.3.0 and we're now using it with 4.4.0.

ndroe
Posts: 18
Joined: Fri 03 Feb 2012 16:08

Re: Error Running Migration Down

Post by ndroe » Tue 23 Oct 2012 14:39

This appears to be related to one of the default conventions. When I changed my code to not remove all the default conventions, it works again.

ndroe
Posts: 18
Joined: Fri 03 Feb 2012 16:08

Re: Error Running Migration Down

Post by ndroe » Wed 24 Oct 2012 14:53

I was just able to reproduce this error even with all the default conventions enabled.

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

Re: Error Running Migration Down

Post by Shalex » Fri 26 Oct 2012 16:51

Please specify the following information:
1) all your current configuration settings of EF-provider;
2) if you remember, also tell us the options you used when applying the first migration.

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

Re: Error Running Migration Down

Post by Shalex » Tue 30 Oct 2012 14:54

We have investigated the situation and suppose the following possible scenario:
1. The first migration was applied with the default configuration options of dotConnect for Oracle. As a result, the __MigrationHistory table was generated with the NVARCHAR2 columns.
2. Then the UseNonUnicodeStrings configuration option was turned on:

Code: Select all

      var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
      config.CodeFirstOptions.UseNonUnicodeStrings = true;
This option affects the processing of all string columns. So the __MigrationHistory table is considered now as the one with the VARCHAR2 columns, and the VARCHAR2 (not NVARCHAR2) parameters are created when accessing the table. This leads to the ORA-01460 error.

If the situation is described correctly, here is a solution: create __MigrationHistory2 with VARCHAR2 columns (the rest structure in this table is the same as in __MigrationHistory), copy data from __MigrationHistory to __MigrationHistory2, remove __MigrationHistory, rename __MigrationHistory2 to __MigrationHistory.

Post Reply