fixed migration script and database connection