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§

source

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.

source

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>.

source

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.

source

fn add_type(&mut self, key: TypeKey, sqltype: DeferredSqlType) -> Result<()>

Adds a TypeKey -> SqlType mapping. Only meaningful on the special current migration.

source

fn set_migration_from(&mut self, prev: Option<String>) -> Result<()>

Set the name of the migration before this one.

Implementors§