I would like to run blue green deployments; however, EF Migrations seem to block that. If I deploy version 1 to the Blue slot, create an EF Migrations and deploy version 2 to the Green slot, then one of two things will happen.
Scenario 1:
I will have run the migration, and version 1 will stop working. This defeats the purpose of being able to test version 2 in the green slot while letting our users run version 1 in the blue slot.
Scenario 2:
I don't run the migration until I switch from the blue slot to the green slot. This means that I can't test the green slot (version 2) before giving users access to version 2.
What is the standard/best practice for handling this?
For workflows like this, you need to make schema changes in two steps.
The first step is to add everything you're going to need for v2 in a way that is compatible with v1. Any new column will need to be optional or, if possible use a default constraint or trigger to populate it based on v1 values.
Once v1 is retired, you can clean up the schema by removing unused columns and making columns required.
NuGet.org has been successfully using this workflow via EF migrations for many years.