Improve the database scheme with PRIMARY KEYS, FOREIGN KEYS, ON DELETE CASCADE and CHECKS
Fix createdb.sql
Fix also the DB update