Struct migrant_lib::migration::EmbeddedMigration
[−]
[src]
pub struct EmbeddedMigration { pub tag: String, pub up: Option<&'static str>, pub down: Option<&'static str>, }
Define an embedded migration
SQL statements provided to EmbeddedMigration
will be embedded in
the executable so no files are required at run-time. The
standard include_str!
macro can be used to embed contents of files.
Database specific features (postgresql
/sqlite
) are required to use
this functionality.
Example
EmbeddedMigration::with_tag("initial")? .up(include_str!("../migrations/embedded/initial/up.sql")) .down(include_str!("../migrations/embedded/initial/down.sql"));
Fields
tag: String
up: Option<&'static str>
down: Option<&'static str>
Methods
impl EmbeddedMigration
[src]
fn with_tag(tag: &str) -> Result<Self>
[src]
Create a new EmbeddedMigration
with the given tag
Tags may contain [a-z0-9-]
fn up(&mut self, stmt: &'static str) -> &mut Self
[src]
Statement to use for up
migrations
fn down(&mut self, stmt: &'static str) -> &mut Self
[src]
Statement to use for down
migrations
fn boxed(&self) -> Box<Migratable>
[src]
Box this migration up so it can be stored with other migrations
Trait Implementations
impl Clone for EmbeddedMigration
[src]
fn clone(&self) -> EmbeddedMigration
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for EmbeddedMigration
[src]
impl Migratable for EmbeddedMigration
[src]
fn apply_up(&self, _db_kind: DbKind, _config: &Config) -> Result<(), Box<Error>>
[src]
Define functionality that runs for up
migrations
fn apply_down(&self, db_kind: DbKind, config: &Config) -> Result<(), Box<Error>>
[src]
Define functionality that runs for down
migrations
fn tag(&self) -> String
[src]
A unique identifying tag
fn description(&self, _: &Direction) -> String
[src]
Option migration description. Defaults to Migratable::tag