pub struct MemMigrations { /* private fields */ }
Expand description

A collection of migrations stored in memory.

Implementations§

source§

impl MemMigrations

source

pub fn new() -> Self

source

pub fn from_json(json: &str) -> Result<Self>

Trait Implementations§

source§

impl Debug for MemMigrations

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for MemMigrations

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for MemMigrations

source§

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

§

type M = MemMigration

source§

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>

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

Returns migrations since the given migration.
source§

fn all_migrations(&self) -> Result<Vec<Self::M>>

Returns all migrations
source§

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

Get the last migration that has been applied to the database or None if no migrations have been applied
source§

impl MigrationsMut for MemMigrations

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. Read more
source§

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

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

impl Serialize for MemMigrations

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,