Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

one of the tricks you can use is migrate on read. instead of having a global per-db versioning you have schema versioning on a per-record basis.

each version migration is a function that takes a record in an old state a migrates it to a new one.

once you read a record from the db that has an outdated version number you run all the pending migrations and then save.

with this scheme your application code only has to know how to deal with the latest schema version. all the rest is handled by migrations.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: