1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//! Migrator runs passed migrations - entities which implement [`Migration`] trait
pub mod default;
pub mod shell;
pub mod with_connection;
pub mod with_migrations_vec;
pub mod with_shell_config;

use mongodb::Database;

use self::{
    default::DefaultMigrator, shell::Shell, with_connection::WithConnection,
    with_migrations_vec::WithMigrationsVec, with_shell_config::WithShellConfig,
};

pub enum Migrator {
    DefaultMigrator(DefaultMigrator),
    WithConnection(WithConnection),
    WithMigrationsVec(WithMigrationsVec),
    WithShellConfig(WithShellConfig),
}

#[derive(Clone)]
pub struct Env {
    pub db: Option<Database>,
    pub shell: Option<Shell>,
}

impl Default for Env {
    fn default() -> Self {
        Self {
            db: None,
            shell: None,
        }
    }
}