Setup database #1

Merged
GW_MC merged 16 commits from feature/database-setup into master 2025-11-19 21:49:32 +08:00
Showing only changes of commit 800c55238d - Show all commits

View File

@@ -15,7 +15,7 @@ const DB_READY_STRING: [&str; 1] = ["ready to accept connections"];
pub fn get_cli_command() -> CliCommand { pub fn get_cli_command() -> CliCommand {
CliCommand { CliCommand {
command: command(), command: command(),
action: action, action,
} }
} }
@@ -79,7 +79,7 @@ async fn migrate_and_generate_entity(
config: &container::Config, config: &container::Config,
output_path: &str, output_path: &str,
) -> Result<(), ()> { ) -> Result<(), ()> {
let ready_result = await_database_ready(&config).await; let ready_result = await_database_ready(config).await;
if ready_result.is_err() { if ready_result.is_err() {
eprintln!("Database did not become ready in time."); eprintln!("Database did not become ready in time.");
return Err(()); return Err(());
@@ -90,7 +90,7 @@ async fn migrate_and_generate_entity(
ConfigInfoType::PreExisting(pre_existing_info) => &pre_existing_info.url, ConfigInfoType::PreExisting(pre_existing_info) => &pre_existing_info.url,
}; };
let db_type = get_database_type(&config); let db_type = get_database_type(config);
match migrate_database(db_url).await { match migrate_database(db_url).await {
Ok(_) => { Ok(_) => {
println!("Database migrated successfully for {:?}", db_type); println!("Database migrated successfully for {:?}", db_type);
@@ -163,7 +163,7 @@ async fn await_database_ready(config: &container::Config) -> Result<(), ()> {
"Pre-existing database of type {} assumed to be ready.", "Pre-existing database of type {} assumed to be ready.",
pre_existing_info.db_type pre_existing_info.db_type
); );
return Ok(()); Ok(())
} }
} }
} }