In my project we have a branch model that has a separate development branch and has a separate branch for each release. It may look like this:
dev ______ ______
/ \ / \
master --+---+----+---+---+----+----+--- (...)
r1 \______/ r2 \_______/
So we develop on dev merge it to master and then we create a release branch (r1, r2, ...).
We want to use EF 6 (manual not automatic) migrations but we have a question that we don't know how to answer.
Imagine this:
dev _(1)__ ____(4)
/ \ / \
master --+---+----+---+---+----+-(5)*-+--- (...)
r1 \_(2)__/ r2 \(3)______/
Each number is a migration. They have been added to the source control on each branch AND have been applied to the databases of production instances of our project (we support multiple releases for some time just for fixes) so we cannot downgrade them, they can go only Up(). Asterisk marks the point in time we want to analyze. We want migrations to work this way:
- r1 database has only migration (2) applied
- r2 database has (1), (2) and (3) applied
- master database has (1), (2), (4) and (5) applied
- dev database has (1), (2) and (4) applied
Moreover:
- we cannot lose a bit of data in our database
- it has to be possible for r1 database to be updated to r2 (or any other future release) database with no errors so it has the same database structure as all r2 databases (created as r2 or updated from earlier versions) that corresponds to its code first model.
Can that be done? If yes, how?
If you need more details, please ask.