Specify database connection when migrating

This PR adds the configured database connection to the migration scripts.