Fixing SQL queries
Migrating structure in devdb.sql