Fixed database migration