I am using EF Code first with Migrations. I need to update an old database however I have lost some of the migration code. Is there a way to generate the missing migrations?
标签:
ef-migrations
相关问题
- How do I create a migration for an existing databa
- MigrateDatabaseToLatestVersion no running Seed() m
- Entity Framework Code-First Migrations - Cannot dr
- EF Code First - Timeout expired. The timeout perio
- Defining many to many relation in code first entit
相关文章
- How do I create a migration for an existing databa
- MigrateDatabaseToLatestVersion no running Seed() m
- Entity Framework Code-First Migrations - Cannot dr
- EF Code First - Timeout expired. The timeout perio
- Defining many to many relation in code first entit
- Entity framework code first migrations, sql user p
- Schema Migration Scripts in NoSQL Databases
- Create table and insert data into it during EF cod
Step 1: Back up ( obviously )
Step 2: Delete __MigrationHistory
Step 3: Create a temporary project. Use the Entity Data Model Wizard to create the Code-First Model.
Step 4: Enable migrations in the new project ( using Enable-Migrations) at the Package Manager Console.
Create an initial migration ( using add-migration one). Comment out the Up and Down methods of the created migration.
Run update-database.
Step 5: Replace all the files in the Migrations folder of the original project with the files in the temporary project. Editing DbContext and namespace names as required.
Step 6 In the original project in package manager run Add-Migration two then run update-database