rullst-orm 13.0.0-alpha.1

Fast, un-opinionated, database-agnostic ORM and query builder for Rust
Documentation
use rullst_orm::schema::{Schema, Migration};
use rullst_orm::async_trait;

pub struct MigrationImpl;

#[async_trait]
impl Migration for MigrationImpl {
    fn name(&self) -> &'static str {
        "m{timestamp}_{name}"
    }

    // `Schema` calls run in one transaction with this migration's record.
    // Return `false` if `up`/`down` send queries to `Orm::pool()` directly.
    fn within_transaction(&self) -> bool {
        true
    }

    async fn up(&self) -> Result<(), rullst_orm::Error> {
        Schema::create("{name}", |table| {
            table.id();
            table.timestamps();
        }).await
    }

    async fn down(&self) -> Result<(), rullst_orm::Error> {
        Schema::drop_if_exists("{name}").await
    }
}