pub trait MigrationsMut: Migrationswhere
    Self::M: MigrationMut,{
    // Required methods
    fn new_migration(&self, name: &str) -> Self::M;
    fn add_migration(&mut self, m: Self::M) -> Result<()>;
    fn clear_migrations(&mut self, conn: &impl ConnectionMethods) -> Result<()>;
    fn current(&mut self) -> &mut Self::M;
    fn clear_current(&mut self) -> Result<()>;

    // Provided methods
    fn create_migration(
        &mut self,
        backend: &impl Backend,
        name: &str,
        from: Option<&Self::M>
    ) -> Result<bool> { ... }
    fn create_migration_to(
        &mut self,
        backend: &impl Backend,
        name: &str,
        from: Option<&Self::M>,
        to_db: ADB
    ) -> Result<bool> { ... }
}

Required Methods§

source

fn new_migration(&self, name: &str) -> Self::M

Construct a new, uninitialized migration. You may want to use create_migration instead, which provides higher-level functionality.

source

fn add_migration(&mut self, m: Self::M) -> Result<()>

Adds a migration constructed from new_migration into the set of migrations. Should be called after filling in the migration details. Unnecessary when using create_migration.

source

fn clear_migrations(&mut self, conn: &impl ConnectionMethods) -> Result<()>

Clears all migrations – deleting them from this object (and any storage backing it) and deleting the record of their existence/application from the database. The database schema is not modified, nor is any other data removed. Use carefully.

source

fn current(&mut self) -> &mut Self::M

Get a pseudo-migration representing the current state as determined by the last build of models. This does not necessarily match the current state of the database if migrations have not yet been applied.

This migration is named “current”. It is not a “real” migration

  • it should never be applied
  • it will never be returned by latest, migrations_since, all_migrations or other similar methods.
source

fn clear_current(&mut self) -> Result<()>

Clears the current state (as would be returned by the current method).

Provided Methods§

source

fn create_migration( &mut self, backend: &impl Backend, name: &str, from: Option<&Self::M> ) -> Result<bool>

Create a migration from -> current named name. From may be None, in which case the migration is created from an empty database. Returns true if a migration was created, false if from and current represent identical states.

source

fn create_migration_to( &mut self, backend: &impl Backend, name: &str, from: Option<&Self::M>, to_db: ADB ) -> Result<bool>

Create a migration from -> to_db named name. From may be None, in which case the migration is created from an empty database. Returns true if a migration was created, false if from and current represent identical states.

Implementors§