tern_core::migration

Trait Executor

Source
pub trait Executor
where Self: Send + Sync + 'static,
{ type Queries: QueryRepository; // Required methods fn apply_tx( &mut self, query: &Query, ) -> impl Future<Output = TernResult<()>> + Send; fn apply_no_tx( &mut self, query: &Query, ) -> impl Future<Output = TernResult<()>> + Send; fn create_history_if_not_exists( &mut self, history_table: &str, ) -> impl Future<Output = TernResult<()>> + Send; fn drop_history( &mut self, history_table: &str, ) -> impl Future<Output = TernResult<()>> + Send; fn get_all_applied( &mut self, history_table: &str, ) -> impl Future<Output = TernResult<Vec<AppliedMigration>>> + Send; fn insert_applied_migration( &mut self, history_table: &str, applied: &AppliedMigration, ) -> impl Future<Output = TernResult<()>> + Send; fn upsert_applied_migration( &mut self, history_table: &str, applied: &AppliedMigration, ) -> impl Future<Output = TernResult<()>> + Send; }
Expand description

The “executor” type for the database backend ultimately responsible for issuing migration and schema history queries.

Required Associated Types§

Source

type Queries: QueryRepository

The type of value that can produce queries for the history table of this migration set.

Required Methods§

Source

fn apply_tx( &mut self, query: &Query, ) -> impl Future<Output = TernResult<()>> + Send

Apply the Query for the migration in a transaction.

Source

fn apply_no_tx( &mut self, query: &Query, ) -> impl Future<Output = TernResult<()>> + Send

Apply the Query for the migration not in a transaction.

Source

fn create_history_if_not_exists( &mut self, history_table: &str, ) -> impl Future<Output = TernResult<()>> + Send

CREATE IF NOT EXISTS the history table.

Source

fn drop_history( &mut self, history_table: &str, ) -> impl Future<Output = TernResult<()>> + Send

DROP the history table.

Source

fn get_all_applied( &mut self, history_table: &str, ) -> impl Future<Output = TernResult<Vec<AppliedMigration>>> + Send

Get the complete history of applied migrations.

Source

fn insert_applied_migration( &mut self, history_table: &str, applied: &AppliedMigration, ) -> impl Future<Output = TernResult<()>> + Send

Insert an applied migration into the history table.

Source

fn upsert_applied_migration( &mut self, history_table: &str, applied: &AppliedMigration, ) -> impl Future<Output = TernResult<()>> + Send

Update or insert an applied migration.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§