Database migration and models fix