Fix INSERT statement for postgre and sqlite in upgrade

Signed-off-by: emanuele <emanuele45@gmail.com>
Merge pull request #333 from emanuele45/master

A bit of inserts :P