Trait butane_core::migrations::MigrationMut
source · pub trait MigrationMut: Migration {
// Required methods
fn write_table(&mut self, table: &ATable) -> Result<()>;
fn delete_table(&mut self, name: &str) -> Result<()>;
fn add_sql(
&mut self,
backend_name: &str,
up_sql: &str,
down_sql: &str
) -> Result<()>;
fn add_type(&mut self, key: TypeKey, sqltype: DeferredSqlType) -> Result<()>;
fn set_migration_from(&mut self, prev: Option<String>) -> Result<()>;
}
Expand description
A migration which can be modified
Required Methods§
sourcefn write_table(&mut self, table: &ATable) -> Result<()>
fn write_table(&mut self, table: &ATable) -> Result<()>
Adds an abstract table to the migration. The table state should represent the expected state after the migration has been applied. It is expected that all tables will be added to the migration in this fashion.
sourcefn delete_table(&mut self, name: &str) -> Result<()>
fn delete_table(&mut self, name: &str) -> Result<()>
Delete the table with the given name. Note that simply
deleting a table in code does not work – it will remain with
its last known schema unless explicitly deleted. See also the
butane cli command butane delete table <TABLE>
.
sourcefn add_sql(
&mut self,
backend_name: &str,
up_sql: &str,
down_sql: &str
) -> Result<()>
fn add_sql( &mut self, backend_name: &str, up_sql: &str, down_sql: &str ) -> Result<()>
Set the backend-specific commands to apply/undo this migration.