Page 1 of 1

Code first migrations downward migration another oracle error

Posted: Wed 28 Nov 2012 16:31
by John Liu
PM>Update-dababase --- works great
PM> get-migrations
Retrieving migrations that have been applied to the target database.
201211280024083_v1
PM> update-database -targetmigration $initialdatabase -verbose
Using StartUp project 'CodeFirstOracle'.
Using NuGet project 'CodeFirstOracle'.
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Target database is: '' (DataSource: 192.168.20.86, Provider: Devart.Data.Oracle, Origin: Configuration).
Reverting migrations: [201211280024083_v1].
Reverting code-based migration: 201211280024083_v1.
DROP INDEX AZTECA.IX_155018658
DROP INDEX AZTECA.IX_CASE_STOP_SEVERITY_FLAG_ID
DROP INDEX AZTECA.IX_756177537
DROP INDEX AZTECA.IX_FLAGS_TABLE_NAME
DROP INDEX AZTECA.IX_FLAGS_ORG_ID
DROP INDEX AZTECA.IX_FLAGS_SEVERITY
DROP INDEX AZTECA.IX_FLAGS_DISCIPLINE_ID
DROP INDEX AZTECA.IX_CA_FLAGS_SEVERITY
DROP INDEX AZTECA.IX_CA_FLAGS_FLAG_ID
DROP INDEX AZTECA.IX_CA_FLAGS_DISCIPLINE_ID
DROP INDEX AZTECA.IX_CA_FLAGS_CA_OBJECT_ID
DROP INDEX AZTECA.IX_DISCIPLINE_ORG_ID
DROP INDEX AZTECA.IX_DISCIPLINE_INSPECTOR_ID
DROP INDEX AZTECA.IX_INSPECTOR_USER_ID
Devart.Data.Oracle.OracleException (0x80004005): ORA-02429: cannot drop index used for enforcement of unique/primary key
at Devart.Data.Oracle.t.d()
at Devart.Data.Oracle.ar.h()
at Devart.Data.Oracle.ar.c()
at Devart.Data.Oracle.aa.a(Int32 A_0, bw 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.Data.Oracle.OracleCommand.ExecuteNonQuery()
at System.Data.Entity.Migrations.DbMigrator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ExecuteSql(DbTransaction transaction, MigrationStatement migrationStatement)
at System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable`1 migrationStatements)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.ExecuteStatements(IEnumerable`1 migrationStatements)
at System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, XDocument targetModel, IEnumerable`1 operations, Boolean downgrading, Boolean auto)
at System.Data.Entity.Migrations.DbMigrator.RevertMigration(String migrationId, DbMigration migration, XDocument targetModel)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.RevertMigration(String migrationId, DbMigration migration, XDocument targetModel)
at System.Data.Entity.Migrations.DbMigrator.Downgrade(IEnumerable`1 pendingMigrations)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Downgrade(IEnumerable`1 pendingMigrations)
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()
ORA-02429: cannot drop index used for enforcement of unique/primary key

The database is partially updated which is not acceptable.
Thanks

Re: Code first migrations downward migration another oracle error

Posted: Thu 29 Nov 2012 15:58
by Shalex
John Liu wrote:Devart.Data.Oracle.OracleException (0x80004005): ORA-02429: cannot drop index used for enforcement of unique/primary key
Could you please send us a small test project to reproduce the issue in our environment?
John Liu wrote:The database is partially updated which is not acceptable.
We will post about the results of our investigation concerning the "rollback" issue in this thread: http://forums.devart.com/viewtopic.php?t=25354.

Re: Code first migrations downward migration another oracle error

Posted: Tue 04 Dec 2012 16:11
by John Liu
Never mind. The problem was generated by other portion of our code that modified the index to make it unique. then drop index doesn't work any more. The provider works correctly as expected.
thanks