Update dependencies and lints

This commit is contained in:
2026-09-07 22:31:04 -07:00
parent b518d762f1
commit 9c288d051c
79 changed files with 3473 additions and 2923 deletions
+15 -3
View File
@@ -1,15 +1,26 @@
//! Types and functions related to [DatabaseConnection]s
//! Types and functions related to [`DatabaseConnection`]s.
use sea_orm::{DatabaseConnection, DbErr};
use sea_orm_migration::MigratorTrait as _;
/// A newtype wrapping a [DatabaseConnection]
/// A newtype wrapping a [`DatabaseConnection`].
#[derive(Debug)]
pub struct Connection(DatabaseConnection);
impl Connection {
/// Helper function for applying database migrations while wrapping a
/// [DatabaseConnection] in a newtype
/// [`DatabaseConnection`] in a newtype.
///
/// # Errors
/// Fails if connecting or applying migrations fail.
#[inline]
pub async fn try_from(db: DatabaseConnection) -> Result<Self, DbErr> {
// The migrations only create views which store no data, so it is
// important to down before up since modifications are impossible.
//
// Syncing the schema registry allows all real tables to be upgraded.
// It is important to sync twice to ensure internal consistency so that
// the views can be recreated on the latest schema.
crate::migration::Migrator::down(&db, None).await?;
db.get_schema_registry("flix_db::*").sync(&db).await?;
db.get_schema_registry("flix_db::*").sync(&db).await?;
@@ -19,6 +30,7 @@ impl Connection {
}
impl AsRef<DatabaseConnection> for Connection {
#[inline]
fn as_ref(&self) -> &DatabaseConnection {
&self.0
}