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
|
||||
|
||||
define run_migrations ## run database migrations
|
||||
unset DATABASE_URL && cd db/migrations/ && cargo build
|
||||
cd db/migrations/ && cargo run
|
||||
endef
|
||||
|
||||
|
|
|
@ -15,15 +15,15 @@ async fn main() {
|
|||
}
|
||||
|
||||
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()
|
||||
.max_connections(2)
|
||||
.connect(&db_url)
|
||||
.await
|
||||
.expect("Unable to form database pool");
|
||||
|
||||
// sqlx::migrate!("../../migrations/")
|
||||
// .run(&db)
|
||||
// .await
|
||||
// .unwrap();
|
||||
sqlx::migrate!("../../migrations/")
|
||||
.run(&db)
|
||||
.await
|
||||
.unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue