Struct butane_core::migrations::MemMigrations
source · pub struct MemMigrations { /* private fields */ }
Expand description
A collection of migrations stored in memory.
Implementations§
Trait Implementations§
source§impl Debug for MemMigrations
impl Debug for MemMigrations
source§impl Default for MemMigrations
impl Default for MemMigrations
source§impl<'de> Deserialize<'de> for MemMigrations
impl<'de> Deserialize<'de> for MemMigrations
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Migrations for MemMigrations
impl Migrations for MemMigrations
type M = MemMigration
source§fn get_migration(&self, name: &str) -> Option<Self::M>
fn get_migration(&self, name: &str) -> Option<Self::M>
Gets the migration with the given name, if it exists
source§fn latest(&self) -> Option<Self::M>
fn latest(&self) -> Option<Self::M>
Get the most recent migration (other than
current
) or None
if
no migrations have been created.source§fn migrations_since(&self, since: &Self::M) -> Result<Vec<Self::M>>
fn migrations_since(&self, since: &Self::M) -> Result<Vec<Self::M>>
Returns migrations since the given migration.
source§fn unapplied_migrations(
&self,
conn: &impl ConnectionMethods
) -> Result<Vec<Self::M>>
fn unapplied_migrations( &self, conn: &impl ConnectionMethods ) -> Result<Vec<Self::M>>
Get migrations which have not yet been applied to the database
source§fn last_applied_migration(
&self,
conn: &impl ConnectionMethods
) -> Result<Option<Self::M>>
fn last_applied_migration( &self, conn: &impl ConnectionMethods ) -> Result<Option<Self::M>>
Get the last migration that has been applied to the database or None
if no migrations have been applied
source§impl MigrationsMut for MemMigrations
impl MigrationsMut for MemMigrations
source§fn current(&mut self) -> &mut Self::M
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. Read more
source§fn clear_current(&mut self) -> Result<()>
fn clear_current(&mut self) -> Result<()>
Clears the current state (as would be returned by the
current
method).source§fn new_migration(&self, name: &str) -> Self::M
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<()>
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<()>
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 create_migration(
&mut self,
backend: &impl Backend,
name: &str,
from: Option<&Self::M>
) -> Result<bool>
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>
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.Auto Trait Implementations§
impl RefUnwindSafe for MemMigrations
impl Send for MemMigrations
impl Sync for MemMigrations
impl Unpin for MemMigrations
impl UnwindSafe for MemMigrations
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