@@ -29,10 +29,7 @@ pub async fn execute() -> anyhow::Result<()> {
|
|||||||
std::env::var("DATABASE_URL").context("DATABASE_URL not set")?;
|
std::env::var("DATABASE_URL").context("DATABASE_URL not set")?;
|
||||||
let pool = PgPool::connect(&database_url).await?;
|
let pool = PgPool::connect(&database_url).await?;
|
||||||
|
|
||||||
sqlx::migrate!("../post3/migrations/")
|
post3::MIGRATOR.run(&pool).await?;
|
||||||
.set_locking(false)
|
|
||||||
.run(&pool)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
tracing::info!("database migrations applied");
|
tracing::info!("database migrations applied");
|
||||||
|
|
||||||
|
|||||||
@@ -44,11 +44,7 @@ impl TestServer {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// Run migrations
|
// Run migrations
|
||||||
sqlx::migrate!("../post3/migrations/")
|
post3::MIGRATOR.run(&pool).await.unwrap();
|
||||||
.set_locking(false)
|
|
||||||
.run(&pool)
|
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
// Clean slate
|
// Clean slate
|
||||||
sqlx::query("DELETE FROM upload_parts").execute(&pool).await.unwrap();
|
sqlx::query("DELETE FROM upload_parts").execute(&pool).await.unwrap();
|
||||||
|
|||||||
@@ -9,3 +9,6 @@ pub use backend::StorageBackend;
|
|||||||
pub use error::Post3Error;
|
pub use error::Post3Error;
|
||||||
pub use fs::FilesystemBackend;
|
pub use fs::FilesystemBackend;
|
||||||
pub use store::{PostgresBackend, Store};
|
pub use store::{PostgresBackend, Store};
|
||||||
|
|
||||||
|
/// Embedded database migrations. Run with `MIGRATOR.run(&pool).await`.
|
||||||
|
pub static MIGRATOR: sqlx::migrate::Migrator = sqlx::migrate!("./migrations");
|
||||||
|
|||||||
Reference in New Issue
Block a user