SafeSlingerProject / SafeSlinger-iOS

Source code for iOS platform client SafeSlinger
MIT License
6 stars 2 forks source link

allow database upgrades independant of app version #86

Closed mwfarb closed 8 years ago

mwfarb commented 9 years ago

It would be great to include a mechanism internally for database upgrade detection that isn't tied to the full application version. Maybe we can include a new field in the .plist or something so that the upgrade process can flow smoothly for developers (like me!) on a per-commitment basis.

This idea being, if we commit a change in logic that requires a database schema change, the commitment should include a version check against that .plist variable (which we would rev in the same commit) to determine in the database needs to be updated or not before loading.

brnunes commented 9 years ago

I started doing something on these lines. Here is the code I added for database update. It uses SQLite's PRAGMA user_version. We never used the user_version so initially it is 0. I added a constant CURRENT_DATABASE_VERSION and if the user_version is less than the current version, it calls the appropriate patch methods.

tenmalin commented 8 years ago

Confirmed the approach. It should apply database upgrade depends on user_version flag. Close this issue.