pub enum Migration {
Sql(String),
}Expand description
A database migration generated from a SchemaDiff by a driver.
Currently only SQL migrations are supported. Multiple SQL statements
within a single migration are separated by breakpoint markers
(-- #[toasty::breakpoint]).
§Examples
ⓘ
use toasty_core::schema::db::Migration;
let m = Migration::new_sql("CREATE TABLE users (id INTEGER PRIMARY KEY)".to_string());
assert_eq!(m.statements(), vec!["CREATE TABLE users (id INTEGER PRIMARY KEY)"]);Variants§
Implementations§
Source§impl Migration
impl Migration
Sourcepub fn new_sql_with_breakpoints<S: AsRef<str>>(statements: &[S]) -> Self
pub fn new_sql_with_breakpoints<S: AsRef<str>>(statements: &[S]) -> Self
Creates a SQL migration from multiple SQL statements.
Statements are joined with -- #[toasty::breakpoint] markers.
Sourcepub fn statements(&self) -> Vec<&str>
pub fn statements(&self) -> Vec<&str>
Returns individual SQL statements by splitting on breakpoint markers.
Auto Trait Implementations§
impl Freeze for Migration
impl RefUnwindSafe for Migration
impl Send for Migration
impl Sync for Migration
impl Unpin for Migration
impl UnwindSafe for Migration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more