fix: use offline sqlx compilation while building migrator
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Aravinth Manivannan 2023-10-05 01:35:53 +05:30
parent b98f99eab5
commit 5b8b9c4440
Signed by: realaravinth
GPG key ID: F8F50389936984FF
2 changed files with 6 additions and 5 deletions

View file

@ -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

View file

@ -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();
}