mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-19 13:44:55 +01:00
feat: Add support for sqlcipher
This commit is contained in:
@@ -68,12 +68,25 @@ impl MintSqliteDatabase {
|
||||
}
|
||||
|
||||
/// Create new [`MintSqliteDatabase`]
|
||||
#[cfg(not(feature = "sqlcipher"))]
|
||||
pub async fn new<P: AsRef<Path>>(path: P) -> Result<Self, Error> {
|
||||
Ok(Self {
|
||||
pool: create_sqlite_pool(path.as_ref().to_str().ok_or(Error::InvalidDbPath)?).await?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Create new [`MintSqliteDatabase`]
|
||||
#[cfg(feature = "sqlcipher")]
|
||||
pub async fn new<P: AsRef<Path>>(path: P, password: String) -> Result<Self, Error> {
|
||||
Ok(Self {
|
||||
pool: create_sqlite_pool(
|
||||
path.as_ref().to_str().ok_or(Error::InvalidDbPath)?,
|
||||
password,
|
||||
)
|
||||
.await?,
|
||||
})
|
||||
}
|
||||
|
||||
/// Migrate [`MintSqliteDatabase`]
|
||||
pub async fn migrate(&self) {
|
||||
sqlx::migrate!("./src/mint/migrations")
|
||||
|
||||
Reference in New Issue
Block a user