Throw away flix files in favor of a flix database

This commit is contained in:
2025-09-18 22:41:34 -06:00
parent ba9c3fa03d
commit 06110b91a1
117 changed files with 8645 additions and 1054 deletions
+22
View File
@@ -0,0 +1,22 @@
//! Types and functions related to [DatabaseConnection]s
use sea_orm::{DatabaseConnection, DbErr};
use sea_orm_migration::MigratorTrait as _;
/// A newtype wrapping a [DatabaseConnection]
pub struct Connection(DatabaseConnection);
impl Connection {
/// Helper function for apllying database migrations while wrapping a
/// [DatabaseConnection] in a newtype
pub async fn try_from(database: DatabaseConnection) -> Result<Self, DbErr> {
crate::migration::Migrator::up(&database, None).await?;
Ok(Self(database))
}
}
impl AsRef<DatabaseConnection> for Connection {
fn as_ref(&self) -> &DatabaseConnection {
&self.0
}
}