Migration pattern for logic too complex to cover it with SQL
When you create migration in EF Core you can spice it up with arbitrary SQL query. Yet there is a limit to it — maybe the migration is too complex in technical sense (i.e the SQL cannot handle it) or in readability sense (expressing the logic in SQL is too muddy). In short when migration logic can be only expressed in regular EF Core C# code with queries, filters, loops, ifs, etc.