pub struct PostgresAdapter<'a> { /* private fields */ }
Expand description
An adapter that allows its migrations to act upon PostgreSQL connection transactions.
Implementations§
Source§impl<'a> PostgresAdapter<'a>
impl<'a> PostgresAdapter<'a>
Sourcepub fn new(client: &'a mut Client) -> PostgresAdapter<'a>
pub fn new(client: &'a mut Client) -> PostgresAdapter<'a>
Create a new migrator tied to a PostgreSQL connection.
Sourcepub fn set_metadata_table<S: Into<String>>(&mut self, metadata_table: S)
pub fn set_metadata_table<S: Into<String>>(&mut self, metadata_table: S)
Sets a custom metadata table name for this adapter. By default, the metadata table name is
called schemamama
.
Sourcepub fn setup_schema(&self) -> Result<(), PostgresError>
pub fn setup_schema(&self) -> Result<(), PostgresError>
Create the tables Schemamama requires to keep track of schema state. If the tables already exist, this function has no operation.
Trait Implementations§
Source§impl<'a> Adapter for PostgresAdapter<'a>
impl<'a> Adapter for PostgresAdapter<'a>
Source§type MigrationType = dyn PostgresMigration
type MigrationType = dyn PostgresMigration
An alias to a specific trait that extends
Migration
. Typically, the aforementioned trait
will declare functions that the adapter will use to migrate upwards and downwards.Source§type Error = Error
type Error = Error
An adapter-specific error type that can be returned from any of this trait’s methods.
Source§fn current_version(&self) -> Result<Option<Version>, PostgresError>
fn current_version(&self) -> Result<Option<Version>, PostgresError>
Returns the latest migration version, or
None
if no migrations have been recorded.Source§fn migrated_versions(&self) -> Result<BTreeSet<Version>, PostgresError>
fn migrated_versions(&self) -> Result<BTreeSet<Version>, PostgresError>
Returns a set of the versions of all of the currently applied migrations.
Source§fn apply_migration(
&self,
migration: &dyn PostgresMigration,
) -> Result<(), PostgresError>
fn apply_migration( &self, migration: &dyn PostgresMigration, ) -> Result<(), PostgresError>
Applies the specified migration.
Source§fn revert_migration(
&self,
migration: &dyn PostgresMigration,
) -> Result<(), PostgresError>
fn revert_migration( &self, migration: &dyn PostgresMigration, ) -> Result<(), PostgresError>
Reverts the specified migration.
Auto Trait Implementations§
impl<'a> Freeze for PostgresAdapter<'a>
impl<'a> !RefUnwindSafe for PostgresAdapter<'a>
impl<'a> !Send for PostgresAdapter<'a>
impl<'a> !Sync for PostgresAdapter<'a>
impl<'a> Unpin for PostgresAdapter<'a>
impl<'a> !UnwindSafe for PostgresAdapter<'a>
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