12
Vote

Have a configuration to prevent migrations seed method from being called

description

(Forgive me if this is redundant. I did search the issues and discussions for something related and could not find it.)

With EF5 migraitons, the seed method is always called regardless of schema changes. Arthur VIckers explains the logic behind this in this stackoverflow thread (http://stackoverflow.com/questions/10822618/confusion-over-ef-auto-migrations-and-seeding-seeding-every-program-start).

We need more control over when seeding occurs. A DbMigrationsConfiguration setting perhaps?

SeedOnlyWhenSchemaChanges or something like that?

There are ways to solve this in code, but doing so is cumbersome and not discoverable.

Thanks

comments

RoMiller wrote Feb 7, 2013 at 11:21 PM

EF Team Triage: This is small, we should push to get it into EF6 even though it's lower priority.

jlerman wrote Feb 8, 2013 at 1:18 AM

:)

Dave69B wrote Sep 24, 2013 at 4:05 PM

I would appreciate this feature too. Will it be in EF6?

spongman wrote Oct 29, 2013 at 7:53 PM

This is small
really, it seems like an oversight to force the seed method to be run, even if the schema hasn't changed.

what if the seed method takes an hour to run?

johnny_reilly wrote Jun 23 at 4:28 PM

Hi,

Just wondering if there was an update on the status of this please? I'm guessing this didn't get released with 6 or 6.1 given the status but I wanted to check...

TDenis wrote Sep 3 at 9:10 AM

Maybe SeedOnlyWhenSchemaChanges configuration property is not the best solution.
Maybe it`s better to get both seed methods - one that executes every time and the other that executes on schema changes only.
Or to provide some other way to indicate if a schema has been changed.