How to control which order the EF Core run custom migrations?

c# entity-framework-core

Question

I am running an application that uses custom migrations (the auto generated ones don't fit my requirements). I am trying to understand how to control in which order the Entity Framework will run those migrations. I read on some places that using timestamp on the file names will do it, but that does not work. (it runs 20190131153312_bla before 20190131153208_bla2, for example)

No matter where I look I can't seem to find information on this subject... can anyone help?

1
4
2/3/2019 8:38:32 AM

Accepted Answer

Migration file and class names doesn't matter.

The order of migrations is determined by the migration identifier (string), which is provided by the Id property of the MigrationAttribute associated with the Migration derived classes.

EF Core tools prepend timestamp to the user supplied migration names in order to ensure proper string ordering.

8
2/3/2019 11:26:53 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow