Merge in file backed databases functionality

Note that to migrate an existing events database the following queries should be performed:
```
CREATE TABLE IF NOT EXISTS default_events (id INTEGER PRIMARY KEY AUTOINCREMENT, 
type INT, trigger INT64, device TEXT, devicetype INT, action, duration INT, parent INT, 
processed INT, lastupdate INT64, callback TEXT, description TEXT);

INSERT INTO default_events (id, type, trigger, device, devicetype, action, duration, 
parent, processed, lastupdate, callback, description) 
SELECT  id, type, trigger, device, devicetype, action, duration, parent, 0, 0, 
callback, description FROM [default];

CREATE TABLE IF NOT EXISTS default_extradata (eventid INT, key TEXT,
 value TEXT, processed INT);

INSERT INTO default_extradata (eventid, key, value, processed) 
SELECT eventid, key, value, 0 FROM [default_data];

DROP TABLE [default];
DROP TABLE [default_data];
```