none
Multiple CodeFirst Migration RRS feed

  • Question

  • On my local machine, from Visual Studio, I did a database migration a few times (because the first wasn’t what I wanted) on table myTable. 

    201610202156479_myTable_migration_1.cs
    201610202156479_myTable_migration_2.cs
    201610202156479_myTable_migration_3.cs
    201610202156479_myTable_migration_4.cs

    201610202156479_myTable_migration_1.cs: added 4 new int columns
    201610202156479_myTable_migration_2.cs: in Visual Studio, changed the 4 int columns to be nullable, ie

    public int? intMyNewCol1 { get; set; }

    201610202156479_myTable_migration_3.cs: created foreign key from the 4 new int columns to another table
    201610202156479_myTable_migration_4.cs: removed the 4 new int columns, and added 4 new varchar columns

    I want the last migration (4 new varchar columns) to be the one migrated to Production system.

    When checking in the database migration to TFS, do I need to check in all 4 migrations above ?
    Do we need to do all 4 migrations to the Production database ?

    THank you.

    Tuesday, October 25, 2016 7:48 PM

All replies