tern_core::migration

Trait Migration

Source
pub trait Migration
where Self: Send + Sync,
{ type Ctx: MigrationContext; // Required methods fn migration_id(&self) -> MigrationId; fn content(&self) -> String; fn no_tx(&self) -> bool; fn build<'a>( &'a self, ctx: &'a mut Self::Ctx, ) -> BoxFuture<'a, TernResult<Query>>; // Provided methods fn version(&self) -> i64 { ... } fn to_applied( &self, duration_ms: i64, applied_at: DateTime<Utc>, ) -> AppliedMigration { ... } }
Expand description

A single migration in a migration set.

Required Associated Types§

Source

type Ctx: MigrationContext

A migration context that is sufficient to build this migration.

Required Methods§

Source

fn migration_id(&self) -> MigrationId

Get the MigrationId for this migration.

Source

fn content(&self) -> String

The raw file content of the migration source file.

Source

fn no_tx(&self) -> bool

Whether this migration should not be applied in a database transaction.

Source

fn build<'a>( &'a self, ctx: &'a mut Self::Ctx, ) -> BoxFuture<'a, TernResult<Query>>

Produce a future resolving to the migration query when awaited.

Provided Methods§

Source

fn version(&self) -> i64

The migration version.

Source

fn to_applied( &self, duration_ms: i64, applied_at: DateTime<Utc>, ) -> AppliedMigration

Convert this migration to an AppliedMigration assuming that it was successfully applied.

Implementors§