sqlite - Updating a local database app for Windows Phone 8.1 (Universal) -
i using local database (sqlite) in windows phone (universal) app. need push update app.
my question 'i have little schema change (added 1 field db). change handled wrapper using (https://github.com/praeclarum/sqlite-net). or need write code updating schema without losing data.
i found link. applicable windows phone universal apps using above sqlite wrapper.
this depends on kind of update you're doing.
if take @ the code library you're using you'll notice createtable
method migration calling migratetable
. migratetable
method checks if there new columns need added , adds them table.
foreach (var p in map.columns) { var found = false; foreach (var c in existingcols) { found = (string.compare (p.name, c.name, stringcomparison.ordinalignorecase) == 0); //and on
so if want add new columns without worrying keys , constraints, should covered library. can, after all, test creating initial db , tables, , simulate update.
now, more complex scenarios, there's no such thing databaseschemaupdater
there linq sql, you'll have use table in db called (for example) _version
hold current database version, , schema update based on current version is, , version you're trying update database to.
Comments
Post a Comment