Entity framework migration and seeding specific update

CheGuevarasBeret picture CheGuevarasBeret · Aug 27, 2013 · Viewed 28.5k times · Source

does anyone know how you can seed a specific update using EF 5 migrations? I have existing database, alredy has lookups populated, and am developing some Audit functionality. I have created an AuditType entity and Audit. When I call update-database, I don't want all my seed data from when I first created the database to be re-added. Do I simply have to manuall delete the existing seed data out or can I do something like name a Configuration.cs with the datetime similar to what gets created when I call add-migration?

Thanks

Answer

Greg picture Greg · Sep 5, 2013

You can run a specific migration by specifying the name of the migration. For example, If you have a migration called MyTuesdayMigration.cs, In the package manager console, you would run this command:

update-database -TargetMigration MyTuesdayMigration