Struct migrant_lib::Config [] [src]

pub struct Config {
    pub path: PathBuf,
    // some fields omitted
}

Project configuration/settings

Fields

Methods

impl Config
[src]

[src]

Define an explicit set of Migratable migrations to use.

When using explicit migrations, make sure they are defined on the Config instance before applied migrations are loaded from the database. This is required because tag format requirements are stricter for implicit (file-system based) migrations are stricter, requiring a timestamp to maintain a deterministic order.

Example

Be careful when using this code, it's not being tested!
let mut config = Config::load_file_only(&p)?;
config.use_migrations(vec![
    EmbeddedMigration::with_tag("initial")?
        .up(include_str!("../migrations/initial/up.sql"))
        .down(include_str!("../migrations/initial/down.sql"))
        .boxed(),
    FileMigration::with_tag("second")?
        .up("migrations/second/up.sql")?
        .down("migrations/second/down.sql")?
        .boxed(),
    FnMigration::with_tag("custom")?
        .up(migrations::Custom::up)
        .down(migrations::Custom::down)
        .boxed(),
])?;
let config = config.reload()?;

[src]

Migrations are explicitly defined

[src]

Do a full reload of the configuration file, keeping track of manually specified migrations

[src]

Load config file from the given path without querying the database to check for applied migrations

[src]

Load config file from the given path and query the database to load up applied migrations

[src]

Start a config initializer in the given directory

[src]

  • Confirm the database can be accessed
  • Setup the database migrations table if it doesn't exist yet

[src]

Return the absolute path to the directory containing migration folders

[src]

Return the database type

[src]

Return the absolute path to the database file. This is intended for sqlite3 databases only

[src]

Generate a database connection string. Not intended for file-based databases (sqlite)

Trait Implementations

impl Debug for Config
[src]

[src]

Formats the value using the given formatter.

impl Clone for Config
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more