Moved templates to be embedded in executable
This commit is contained in:
parent
b676be8cb2
commit
1c1a9589b7
25 changed files with 957 additions and 256 deletions
|
|
@ -1,3 +1,4 @@
|
|||
use log::{error, info};
|
||||
use sqlx::{migrate::MigrateDatabase, Sqlite, SqlitePool};
|
||||
|
||||
pub mod models;
|
||||
|
|
@ -6,8 +7,11 @@ pub async fn create_db(db_url: &str) -> sqlx::Result<SqlitePool> {
|
|||
if !Sqlite::database_exists(db_url).await.unwrap_or(false) {
|
||||
println!("Creating database {}", db_url);
|
||||
match Sqlite::create_database(db_url).await {
|
||||
Ok(_) => println!("create db success"),
|
||||
Err(e) => panic!("Cannot create db: {e:?}"),
|
||||
Ok(_) => info!("create db success"),
|
||||
Err(e) => {
|
||||
error!("Cannot create db at {db_url}: {e:?}");
|
||||
panic!("Cannot create db at {db_url}: {e:?}")
|
||||
}
|
||||
};
|
||||
} else {
|
||||
println!("Database already exists")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue