4 ms·
The OP question was "during development". I obviously change the schema in production too: sometimes keeping null-values will work, sometimes a migration will b
by thibaut_barrere 16y ago
The OP question was "during development". I obviously change the schema in production too: sometimes keeping null-values will work, sometimes a migration will be needed.
My point is that I only do the "production" migration when needed and once per release that requires it, while I can tweak the schema at ease while developing.
If you have a large-enough volume of data, you will meet the situation where just adding a single column takes ages, too.
- jamwt 16y agoDo a lazy migration--aka, every document gets tagged with current version. The restoration/model routines have a transparent upgrade chain (1->2, 2->3) that move any loaded document up the chain until they reach the current version; then, the app code acts as though all documents are magically updated. If you're worried about performance, have the upgrade chain write out the latest version so it's only upgraded once. Works like a charm. No migration headaches.
- saurik 16y agoAdding/deleting/renaming a column is instantaneous as it doesn't involve updating any of the rows on disk: I add columns to tables that have a hundred million rows all the time. (PostgreSQL)