Problem: We need a test environment that can use the same database for different code changes without having to have the code to support all the different database changes.
Things sometimes break because the code and the database are not in sync (ex: can't find column)
Here's an example of my solution to the problem that I can't properly describe, which has its own problem at the end:
We have these branches:
Develop
Team_branch
New_Feature_Branch
Main_Test_Environment uses Develop branch which uses Main_Database
Team_Test_Environment uses Team_Branch which uses Team_Database
Once New_Feature_Branch is finished it is added to Team_Branch to be tested on Team_Test_Environment
Let's say New_Feature_Branch is all good to go live. How do we get New_Feature_Branch into Develop branch without all the changes from Team_Branch?
This would be easy if we didn't need the Team_Branch changes in our New_Feature_Branch to begin working on it:
New Feature from Develop -> Finish Feature -> Merge into Team_Branch -> Was approved -> Merge feature into Develop.
Done. However because we're using a different database and need to have our code and database synced, we NEED to start like this:
New feature from Team_Branch -> Finish Feature -> Merge into Team_Branch -> Was approved -> Merge feature into Develop.
BAD AND WRONG
Now we have all the Team_Branch changes in Develop branch when we only want the New_Feature_Branch!
How do we solve this?
EDIT in response to merge-base as a solution:
I tested it out, but unfortunately it seems like it won't do the job. Because:
Feature_1 created from the merge-base -> finished feature -> merged into Team_Branch to be published for testing.
Feature_2 created from the merge-base -> Error! Because Feature_1 changed stuff on code and database and we don't have Feature_1 commits but we're using the same database.
That's why starting from Team_Branch is necessary (I think?) to have the latest changes and not have to create a new database.
And I do want to keep Team_Branch as up to date with Develop as possible, so I will be merging Develop into Team_Branch often.