ormdroid
ormdroid copied to clipboard
Database Upgrade/Migration
Are you thinking about implementing a way to be able to upgrade/migrate the database ?
I see 2 ways :
- Adding Version in Manifest and a script in assets to allow manual migration
- Adding Version in Manifest and checking Tables programmatically at the app init
Of course, there are other ways to do that. What are your thoughts about it @roscopeco ?
I would love to implement something like this (it's been discussed a bit before). However, I'm not sure it would be best as part of the core lib, or as an add-on.
In any event, it's always been on the todo list, but not something I've gotten around to...
I like the script idea (a la rails migrations) but what language? I wouldn't want to bloat the core lib by including some kind of interpreter ideally...
Yeah, the script idea is the best I think as it will be the most performant. I was thinking of SQL Scripts. Like seen in this [ http://stackoverflow.com/questions/4253804/insert-new-column-into-table-in-sqlite ] post. It will enable the developer to have full control.
But, it'd be so nice to allow database upgrade without the developer knowing it, just checking everything is fine, or if it's not, altering tables, and all of that programmatically... Anyway, it's not an easy (Table name change, Column name change...) and perfomant (Much more SQL request would be executed) solution, so I would stick to the first, which meet the needs.