Added database changes to upgrade_*.sql

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

Added database changes to upgrade_*.sql from 1.0.1