C
C#12mo ago
Butterfly

How the mgiration works internally?

For example, I have 5 migrations added and the sql database is updated with those 5 migrations. For some reasons, I had to roll back to the first migration by removing the four migrations. Now the question is 1. How does EF core works to which migration to roll back? My understanding is they compare with MigraitonHistory Table in the sql and check with snapshot.cs file to compare? 2. How Down methods are executed? I updated to the first migration means 4 migrations down methods are executed or not? 3. How the design.cs and snapshot.cs are used when updating the db using EF core? I think snapshot shows the current snapshot without the recent migration and design.cs has the data including the relevant migraiton file. Could you guys fill me up?
1 Reply
Omnissiah
Omnissiah12mo ago
all the operations are just bringing a database to a specific migration, update or roll back yeah obviously it's going to execute down or up methods as needed it's pretty intuitive, it's like commits a versioning system snapshot and design are used when adding or removing migrations what are you worried about?
Want results from more Discord servers?
Add your server