Struct schemer_rusqlite::RusqliteAdapter
source · pub struct RusqliteAdapter<'a, E> { /* private fields */ }
Expand description
Adapter between schemer and SQLite.
Implementations§
source§impl<'a, E> RusqliteAdapter<'a, E>
impl<'a, E> RusqliteAdapter<'a, E>
sourcepub fn new(
conn: &'a mut Connection,
table_name: Option<String>
) -> RusqliteAdapter<'a, E>
pub fn new( conn: &'a mut Connection, table_name: Option<String> ) -> RusqliteAdapter<'a, E>
Construct a SQLite schemer adapter.
table_name
specifies the name of the table that schemer will use
for storing metadata about applied migrations. If None
, a default
will be used.
let mut conn = rusqlite::Connection::open_in_memory().unwrap();
let adapter: schemer_rusqlite::RusqliteAdapter<RusqliteError> = schemer_rusqlite::RusqliteAdapter::new(&mut conn, None);
sourcepub fn init(&self) -> Result<(), RusqliteError>
pub fn init(&self) -> Result<(), RusqliteError>
Initialize the schemer metadata schema. This must be called before
using Migrator
with this adapter. This is safe to call multiple times.
Trait Implementations§
source§impl<'a, E: From<RusqliteError> + Sync + Send + Error + 'static> Adapter for RusqliteAdapter<'a, E>
impl<'a, E: From<RusqliteError> + Sync + Send + Error + 'static> Adapter for RusqliteAdapter<'a, E>
§type MigrationType = dyn RusqliteMigration<Error = E> + 'static
type MigrationType = dyn RusqliteMigration<Error = E> + 'static
Type migrations must implement for this adapter.
source§fn applied_migrations(&mut self) -> Result<HashSet<Uuid>, Self::Error>
fn applied_migrations(&mut self) -> Result<HashSet<Uuid>, Self::Error>
Returns the set of IDs for migrations that have been applied.
source§fn apply_migration(
&mut self,
migration: &Self::MigrationType
) -> Result<(), Self::Error>
fn apply_migration( &mut self, migration: &Self::MigrationType ) -> Result<(), Self::Error>
Apply a single migration.
source§fn revert_migration(
&mut self,
migration: &Self::MigrationType
) -> Result<(), Self::Error>
fn revert_migration( &mut self, migration: &Self::MigrationType ) -> Result<(), Self::Error>
Revert a single migration.