fix: use offline sqlx compilation while building migrator
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
b98f99eab5
commit
5b8b9c4440
2 changed files with 6 additions and 5 deletions
1
Makefile
1
Makefile
|
@ -15,6 +15,7 @@ define deploy_dependencies ## deploy dependencies
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define run_migrations ## run database migrations
|
define run_migrations ## run database migrations
|
||||||
|
unset DATABASE_URL && cd db/migrations/ && cargo build
|
||||||
cd db/migrations/ && cargo run
|
cd db/migrations/ && cargo run
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
@ -15,15 +15,15 @@ async fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn postgres_migrate() {
|
async fn postgres_migrate() {
|
||||||
let db_url = env::var("DATABASE_URL").expect("set POSTGRES_DATABASE_URL env var");
|
let db_url = env::var("DATABASE_URL").expect("set DATABASE_URL env var");
|
||||||
let db = PgPoolOptions::new()
|
let db = PgPoolOptions::new()
|
||||||
.max_connections(2)
|
.max_connections(2)
|
||||||
.connect(&db_url)
|
.connect(&db_url)
|
||||||
.await
|
.await
|
||||||
.expect("Unable to form database pool");
|
.expect("Unable to form database pool");
|
||||||
|
|
||||||
// sqlx::migrate!("../../migrations/")
|
sqlx::migrate!("../../migrations/")
|
||||||
// .run(&db)
|
.run(&db)
|
||||||
// .await
|
.await
|
||||||
// .unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue