DataModel Changes and Migrations

DataModel Changes and Migrations

  
A few weeks ago, I was changing a project in a client, and we realized that a breaking change in the database had to be made.
 
Since the project was already in production, we had to cater for the need to migrate data to the new model, perform the changes in the application, and all of this minimizing the impact in production, and if possible, in one go.
 
This is how I’ve done it:
1 – Change the DataModel to an intermediary one, where the old and new coexisted. This is not always possible, but in my case it was;
2 – Create a data migration timer that takes the data from the old to the new model. All done in OutSystems of course J
3 – Create a solution and add the migrations and intermediary model, after being tested, as a version of that solution;
4 – Change you application to have only the new model and add it again to the solution;
5 – Take both solution versions to production and run them one after the other.
 
What about you, how would you achieve it?
Hi Pedro,

Great suggestion!

I just did a small example to illustrate a similar scenario as yours: in my case I wanted to change an entity's primary key. So it's not as complex as a solution's dillema, but passes the message in just 2 steps. Check out the attached archive, folks:

step 1. the initial sample app: contains an ExampleLookup entity with an Integer non-Autonumber Primary Key

step 2. the middle phase: implemented a timer to copy the Foreign Key values and disable certain database constraints;

step 3. the final result: replaced all the old ExampleLookup's references with the new one. Thanks, TrueChange!

I think a lot of scenarios and arguments can be raised here, however. Was it okay to recreate a new entity? Certainly some cleanup should be done here. But at least no data was lost, that's the good thing about the platform - it never removes data, unless we say so.


Thanks for ilustrating that in a demo Pedro!

Nice work!
Still about this topic, please check the Refactor component. The demo provides all the steps you need to know about this process and other stuff as well.