use migration::{Migrator, MigratorTrait}; use sea_orm::{Database, DatabaseConnection, DbErr}; use std::env; pub async fn get_connection() -> Result { let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); let db_connection = Database::connect(database_url).await?; Migrator::up(&db_connection, None).await?; Ok(db_connection) }