How do I force Entity Framework to mark a particular migration as having been applied?

前端 未结 3 1551
-上瘾入骨i
-上瘾入骨i 2021-02-04 05:01

I\'m using Entity Framework 5 in a project, and I\'ve got Migrations enabled.

Here\'s the scenario:

A new developer (dev1) comes on and builds the project from

3条回答
  •  梦谈多话
    2021-02-04 05:24

    I figured out a hack.

    Run Update-Database -Script

    Pick out all the migrations that have already been run

    INSERT INTO [__MigrationHistory] ([MigrationId], [Model], [ProductVersion]) VALUES
    

    Open Sql Server Management Studio, and run those sql statements manually.

    New migrations should work fine.

提交回复
热议问题