Skip to content

Commit e584e6e

Browse files
Dev: allow dev db setup to run dynamically & prune workflow
1 parent f1c2494 commit e584e6e

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

crates/lib/lib-core/src/_dev_util/dev_db.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use sqlx::postgres::PgPoolOptions;
2+
use sqlx::{Pool, Postgres};
13
use std::fs;
24
use std::path::{Path, PathBuf};
35
use std::time::Duration;
4-
use sqlx::{Pool, Postgres};
5-
use sqlx::postgres::PgPoolOptions;
66
use tracing::info;
77

88
type Db = Pool<Postgres>;
@@ -52,9 +52,7 @@ pub async fn init_dev_db() -> Result<(), Box<dyn std::error::Error>> {
5252
for path in paths {
5353
let path_str = path.to_string_lossy();
5454

55-
if path_str.ends_with(".sql")
56-
&& !path_str.ends_with(SQL_RECREATE_DB_FILE_NAME)
57-
{
55+
if path_str.ends_with(".sql") && !path_str.ends_with(SQL_RECREATE_DB_FILE_NAME) {
5856
pexec(&app_db, &path).await?;
5957
}
6058
}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use crate::ctx::Error;
12
use tokio::sync::OnceCell;
23
use tracing::info;
3-
use crate::ctx::Error;
44

55
mod dev_db;
66

@@ -11,5 +11,6 @@ pub async fn init_dev() {
1111
info!("{:<12} - init dev_all", "FOR_DEV_ONLY");
1212

1313
dev_db::init_dev_db().await.unwrap()
14-
}).await;
15-
}
14+
})
15+
.await;
16+
}

crates/lib/lib-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pub mod ctx;
21
pub mod _dev_util;
2+
pub mod ctx;

crates/lib/services/web_server/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ use httpc_test::new_client;
2222
// use tokio::net::TcpListener;
2323
// use tower_cookies::CookieManagerLayer;
2424
use crate::config::web_config;
25+
use lib_core::_dev_util;
2526
use lib_web::routes::routes_static;
2627
use tracing::info;
2728
use tracing_subscriber::{EnvFilter, fmt, prelude::*};
28-
use lib_core::_dev_util;
2929
// endregion: --- Modules
3030

3131
#[tokio::main]

0 commit comments

Comments
 (0)