Code Shipping - State vs Code Change
1 - About
Code is easy,
State is hard Edson Yanaga (Microservices Evolution: How to break your monolithic database)
2 - Why ?
- Code = Checkout a commit, create and replace migration
- State = State Change happens serially.
- You need to know in which state you are to apply the change
- Data must be managed, code not. A new insert means a new decision
- Manually: Creating a rollback + release + a build script. If a change occurs, you apply the rollback and then the release. If you want to recreate the database, you drop all tables and apply the build script (ie a succession of release). A rollback means a delete of a column. You may loose data created for instance by a tester.
- Framework: A framework where the relationship between the state and the script is held somewhere. It permits then to apply the diff between the actual state of the database and the scripts that must be fired to go to another state
3 - Pull request
Two pull request to minimize the risk
- First Db
- Then code…