Digital Ocean Deployment
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user