1

I have just started testing migrations in several different team scenarios to make sure migrations will work as expected with git / multiple users / multiple branches. But I have run into an issue right off the bat. On branch 1 I added my Initial migration (on an existing project with 165 entities), deleting the code in Up/Down (just uses the model snapshot), then update-databased (creates the __MigrationHistory table just fine). I merge this to branch 2 (EXACTLY the same model – exact replica of branch 1), ran update-database with my newly merged migrations and it says Unable to update database to match the current model because there are pending changes. There aren’t pending changes, both models are exactly the same. Is there something I am missing here? I thought I should only run into this issue once migrations are out of whack (merge, model changes from different users).

So why must I do add-migration Initial on both branch 1 and branch 2? They are merged and exactly the same.

Notes: EF 5 (technically 4.4) with .NET 4.0. DevArt dotConnect for Oracle v 8.1.55.0

EDIT: I have read this post but I am not on different platforms, I'm on the same computer - just different branches.

Community
  • 1
  • 1
Jack
  • 9,156
  • 4
  • 50
  • 75
  • If you do `add-migration` on branch 2 after merging, is anything added to the `Up()` method? Does the meta data in the code/resource file differ? – Anders Abel Dec 23 '13 at 21:27
  • Actually I was just doing that, and the hash in branch 1 has 85656 characters - branch 2 has 85660 characters. – Jack Dec 23 '13 at 21:30
  • Sometimes when working with EF Migrations it is just too much of a black box. If nothing is added to the `Up()` method and only meta data differs I have no idea what to do. I've been thinking about writing a tool that can deserialize the meta data from the code as well as loading the meta data from a DB and compare it. If I only had more time... – Anders Abel Dec 23 '13 at 21:38
  • I did what you said, and the difference is my Schema name. It is stored in the EDMX. My two databases are [obviously] named differently. Well then, this poses an interesting problem. Just because I target a different database I will always have "Model" changes. This may be Oracle / Devart specific so I will ask them. – Jack Dec 23 '13 at 22:29

1 Answers1

1

I figured it out, in my initial testing of moving off of EDMX to dotConnect code-first + migrations, I added the schema to the _Mapping files for my fluent mappings. I had to remove this schema. Example:

Instead of:

this.ToTable("ADDRESS", "SCHEMA");

I had to use:

this.ToTable("ADDRESS");

Also I use these options in OnModelCreating:

var config = Devart.Data.Oracle.Entity.Configuration.OracleEntityProviderConfig.Instance;
config.Workarounds.IgnoreDboSchemaName = true;
config.Workarounds.IgnoreSchemaName = true;
Jack
  • 9,156
  • 4
  • 50
  • 75