Digital Ocean Deployment

This commit is contained in:
Nick Bland
2022-01-03 17:11:11 +10:00
parent 6741ed9e14
commit bfcaa6f487
8 changed files with 87 additions and 19 deletions

View File

@@ -49,16 +49,16 @@ async fn spawn_app() -> TestApp {
pub async fn configure_database(config: &DatabaseSettings) -> PgPool {
// Create database
let mut connection = PgConnection::connect(&config.connection_string_without_db())
let mut connection = PgConnection::connect(&config.without_db())
.await
.expect("Failed to connect to Postgres");
connection
.execute(&*format!(r#"CREATE DATABASE "{}";"#, config.database_name))
.execute(&*format!(r#"CREATE DATABASE "{}";"#, config.database_name).as_str())
.await
.expect("Failed to create database.");
// Migrate database
let connection_pool = PgPool::connect(&config.connection_string())
let connection_pool = PgPool::connect(config.with_db())
.await
.expect("Failed to connect to Postgres.");
sqlx::migrate!("./migrations")