added auto migrations and made cargo rebuild if migrations changed
This commit is contained in:
parent
779381df2d
commit
7fbfbaa039
3
build.rs
Normal file
3
build.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
println!("cargo:rerun-if-changed=migrations");
|
||||
}
|
|
@ -15,6 +15,9 @@ pub struct Database {
|
|||
|
||||
impl Database {
|
||||
pub async fn new(config: &Config) -> anyhow::Result<Self> {
|
||||
|
||||
sqlx::migrate!("./migrations");
|
||||
|
||||
log::info!("Database connecting to {}", config.database.url);
|
||||
let conn = PgPoolOptions::new()
|
||||
.max_connections(5)
|
||||
|
|
Loading…
Reference in New Issue
Block a user