Last active
January 14, 2026 20:47
-
-
Save ssougnez/3182179b71ab0d423267c4da2c622730 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class AppMigrationEngine: BaseMigrationEngine | |
| { | |
| public override async Task RunBeforeAsync() | |
| { | |
| // Runs before anything else | |
| } | |
| public override async Task RunBeforeDatabaseMigrationAsync(IDictionary < string, object > cache) | |
| { | |
| // Runs before EF Core migrations | |
| // Use this to capture data before schema changes | |
| var oldData = await _db.Orders.Select(o => new | |
| { | |
| o.Id, o.LegacyStatus | |
| }).ToListAsync(); | |
| cache["oldStatuses"] = oldData; | |
| } | |
| public override async Task RunAfterDatabaseMigrationAsync() | |
| { | |
| // Runs after EF Core migrations, before application migrations | |
| } | |
| public override async Task RunAfterAsync() | |
| { | |
| // Runs after everything is done | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment