Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions optd-persistent/src/bin/migrate_test.rs

This file was deleted.

6 changes: 2 additions & 4 deletions optd-persistent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,16 @@ pub struct BackendManager {

impl BackendManager {
/// Creates a new `BackendManager`.
pub async fn new() -> StorageResult<Self> {
pub async fn new(database_url: Option<&str>) -> StorageResult<Self> {
Ok(Self {
db: Database::connect(DATABASE_URL).await?,
db: Database::connect(database_url.unwrap_or(DATABASE_URL)).await?,
latest_epoch_id: AtomicUsize::new(0),
})
}
}

pub const DATABASE_URL: &str = "sqlite:./sqlite.db?mode=rwc";
pub const DATABASE_FILE: &str = "./sqlite.db";
pub const TEST_DATABASE_URL: &str = "sqlite:./test.db?mode=rwc";
pub const TEST_DATABASE_FILE: &str = "./test.db";

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