Struct migrant_lib::migration::FileMigration[][src]

pub struct FileMigration {
    pub tag: String,
    pub up: Option<PathBuf>,
    pub down: Option<PathBuf>,
    // some fields omitted
}
Expand description

Define a migration that uses SQL statements saved in files.

Note: Files defined in this migration must be present at run-time. File paths can be absolute or relative. Relative file paths are relative to the directory from which the program is run.

Note: SQL statements are batch executed as is. If you want your migration to happen atomically in a transaction you should manually wrap your statements in a transaction (begin transaction; ... commit;).

Fields

tag: Stringup: Option<PathBuf>down: Option<PathBuf>

Implementations

Create a new FileMigration with a given tag

Define the file to use for running up migrations.

Note: Files defined in this migration must be present at run-time. File paths can be absolute or relative. Relative file paths are relative to the directory from which the program is run.

Define the file to use for running down migrations.

Note: Files defined in this migration must be present at run-time. File paths can be absolute or relative. Relative file paths are relative to the directory from which the program is run.

Box this migration up so it can be stored with other migrations

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Define functionality that runs for up migrations

Define functionality that runs for down migrations

A unique identifying tag

Option migration description. Defaults to Migratable::tag

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.