When I run the ef core update database command I would like to be able to specify that the seed operations (Insert, Update, Remove) should be ignore (a flag).
I need this option because when I run migrations in production I do not want to seed.
+1
Or maybe you want to seed data that is specific to that migration. In my case, I have a migration that added a new type and/or status table and I want to go ahead and seed that new table with some values even in production that I plan on using. The having() method didn't work for me as it threw an exception since I have database generated values for my Id (Key) field.
if (Environment.GetEnvironmentVariable("ASPNET_ENVIRONMENT") != "Production")
{
migrationBuilder.InsertData(...);
...
}
Do you mean InsertData?
HasData is for specifying data that will be managed by migrations as your database evolves. Unless you need to preserve the data in the test database as the migrations are applied it would be best to use a different approach to add seed data.