[−][src]Struct barrel::migration::Migration
Represents a schema migration on a database
Methods
impl Migration
[src]
pub fn new() -> Migration
[src]
pub fn schema<S: Into<String>>(self, schema: S) -> Migration
[src]
Specify a database schema name for this migration
pub fn make<T: SqlGenerator>(&self) -> String
[src]
Creates the SQL for this migration for a specific backend
This function copies state and does not touch the original
migration layout. This allows you to call revert
later on
in the process to auto-infer the down-behaviour
pub fn revert<T: SqlGenerator>(&self) -> String
[src]
Automatically infer the down
step of this migration
Will thrown an error if behaviour is ambigous or not
possible to infer (e.g. revert a drop_table
)
pub fn execute<T: DatabaseExecutor, S: SqlGenerator>(&self, runner: &mut T)
[src]
Pass a reference to a migration toolkit runner which will automatically generate and execute
pub fn create_table<S: Into<String>, F: 'static>(
&mut self,
name: S,
cb: F
) -> &mut TableMeta where
F: Fn(&mut Table),
[src]
&mut self,
name: S,
cb: F
) -> &mut TableMeta where
F: Fn(&mut Table),
Create a new table with a specific name
pub fn create_table_if_not_exists<S: Into<String>, F: 'static>(
&mut self,
name: S,
cb: F
) -> &mut TableMeta where
F: Fn(&mut Table),
[src]
&mut self,
name: S,
cb: F
) -> &mut TableMeta where
F: Fn(&mut Table),
Create a new table only if it doesn't exist yet
pub fn change_table<S: Into<String>, F: 'static>(&mut self, name: S, cb: F) where
F: Fn(&mut Table),
[src]
F: Fn(&mut Table),
Change fields on an existing table
pub fn rename_table<S: Into<String>>(&mut self, old: S, new: S)
[src]
Rename a table
pub fn drop_table<S: Into<String>>(&mut self, name: S)
[src]
Drop an existing table
pub fn drop_table_if_exists<S: Into<String>>(&mut self, name: S)
[src]
Only drop a table if it exists
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> IntoSql for T
[src]
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
[src]
Self: AsExpression<T>,
Convert self
to an expression for Diesel's query builder. Read more
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
[src]
&'a Self: AsExpression<T>,
Convert &self
to an expression for Diesel's query builder. Read more