♻️ (seaorm): Adapta al arranque async
- Elimina `run_now` y convierte `initialize()` en `async fn`. - `DBCONN` pasa de `LazyLock` a `OnceLock`; `MigratorBase` adopta `#[pagetop::async_trait]` con métodos async nativos.
This commit is contained in:
parent
1139df6210
commit
9b2d430d8b
8 changed files with 94 additions and 100 deletions
|
|
@ -10,7 +10,7 @@ pub enum SchemaManagerConnection<'c> {
|
|||
Transaction(&'c DatabaseTransaction),
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
#[pagetop::async_trait]
|
||||
impl ConnectionTrait for SchemaManagerConnection<'_> {
|
||||
fn get_database_backend(&self) -> DbBackend {
|
||||
match self {
|
||||
|
|
@ -55,7 +55,7 @@ impl ConnectionTrait for SchemaManagerConnection<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
#[pagetop::async_trait]
|
||||
impl TransactionTrait for SchemaManagerConnection<'_> {
|
||||
async fn begin(&self) -> Result<DatabaseTransaction, DbErr> {
|
||||
match self {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ impl Migration {
|
|||
}
|
||||
|
||||
/// Performing migrations on a database
|
||||
#[async_trait::async_trait]
|
||||
#[pagetop::async_trait]
|
||||
pub trait MigratorTrait: Send {
|
||||
/// Vector of migrations in time sequence
|
||||
fn migrations() -> Vec<Box<dyn MigrationTrait>>;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
//!
|
||||
//! pub struct Migration;
|
||||
//!
|
||||
//! #[async_trait::async_trait]
|
||||
//! #[pagetop::async_trait]
|
||||
//! impl MigrationTrait for Migration {
|
||||
//! async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
|
||||
//! let table = table_auto(Users::Table)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue