[aerogear-dev] [aerogear-js] portable/fallback-able data migrations?

Douglas Campos qmx at qmx.me
Sat Feb 1 16:08:00 EST 2014


There's a nice feature on IndexedDB which is the version thing +
'upgrade needed' event[1], which we're using for creating the database
automagically[2].

Any ideas on how could we provide an API for something like this, but
which could potentially work with WebSQL too?

var dm = AeroGear.DataManager();
dm.add({
	name: "newStore",
	storageType: "IndexedDB",
	settings: {
		dbVersion: 3,
		upgradeHandler: function (evt) {
			// evt.oldVersion
			// evt.newVersion
			// evt.store
			// do data migration stuff, just caring about objects
	  }
	}
});

How does this sounds? Am I crazier than usual? :)


[1]:https://developer.mozilla.org/en/docs/IndexedDB/Using_IndexedDB#Creating_or_updating_the_version_of_the_database
[2]:https://github.com/aerogear/aerogear-js/blob/master/src/data-manager/adapters/indexeddb.js#L181-L184

-- 
qmx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 527 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/aerogear-dev/attachments/20140201/4efb3410/attachment.bin 


More information about the aerogear-dev mailing list