Skip to content

Commit 63d7827

Browse files
committed
Make database_url configurable and remove migrate_test
1 parent 6ab314f commit 63d7827

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

optd-persistent/src/bin/migrate_test.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

optd-persistent/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,16 @@ pub struct BackendManager {
4545

4646
impl BackendManager {
4747
/// Creates a new `BackendManager`.
48-
pub async fn new() -> StorageResult<Self> {
48+
pub async fn new(database_url: Option<&str>) -> StorageResult<Self> {
4949
Ok(Self {
50-
db: Database::connect(DATABASE_URL).await?,
50+
db: Database::connect(database_url.unwrap_or(DATABASE_URL)).await?,
5151
latest_epoch_id: AtomicUsize::new(0),
5252
})
5353
}
5454
}
5555

5656
pub const DATABASE_URL: &str = "sqlite:./sqlite.db?mode=rwc";
5757
pub const DATABASE_FILE: &str = "./sqlite.db";
58-
pub const TEST_DATABASE_URL: &str = "sqlite:./test.db?mode=rwc";
59-
pub const TEST_DATABASE_FILE: &str = "./test.db";
6058

6159
pub async fn migrate(db: &DatabaseConnection) -> Result<(), DbErr> {
6260
Migrator::refresh(db).await

0 commit comments

Comments
 (0)