sea_orm_migration/
lib.rs

1#[cfg(feature = "cli")]
2pub mod cli;
3pub mod connection;
4pub mod manager;
5pub mod migrator;
6pub mod prelude;
7pub mod schema;
8pub mod seaql_migrations;
9pub mod util;
10
11pub use connection::*;
12pub use manager::*;
13pub use migrator::*;
14
15pub use async_trait;
16pub use sea_orm;
17pub use sea_orm::sea_query;
18pub use sea_orm::DbErr;
19
20pub trait MigrationName {
21    fn name(&self) -> &str;
22}
23
24/// The migration definition
25#[async_trait::async_trait]
26pub trait MigrationTrait: MigrationName + Send + Sync {
27    /// Define actions to perform when applying the migration
28    async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr>;
29
30    /// Define actions to perform when rolling back the migration
31    async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> {
32        Err(DbErr::Migration("We Don't Do That Here".to_owned()))
33    }
34}