EF architecture ~ Execution sequence of Migration data Migration, efmigration
For a single branch project, as long as you generate a version of migration, there will be a corresponding timestamp file, and in the update-database, it will start from the minimum time, execute until the current version of migration. for multiple branch projects, it involves adding your own migration plan on each branch. In this case, we may manually modify the timestamp, to adapt to the migration of our database!
The figure above shows A complex data migration project, which comes from multiple branch projects. When appropriate, there may be 32, 35, and 36 on Branch A, while Branch B may have, 34, after we merge branch A to Branch B, we need to modify the original Branch B, because the dates of your 33 and 34 may be before 35 and 36. At this time, during code generation, the version may be lost, resulting in incomplete database structure. Therefore, we need to modify the migration timestamp file according to the code production time!
Execution order: execute in the order of time, rather than by name!
Production Code: Update-Database-Script-SourceMigration: $ InitialDatabase-TargetMigration: init39
Thank you for reading this article!