sqlcx-core 0.2.1

SQL-first cross-language type-safe code generator — core library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::error::Result;
use crate::migrate::file::MigrationFile;
use crate::migrate::state::AppliedMigration;

/// Abstraction over a database connection capable of applying migrations.
///
/// Implementations are responsible for:
/// - Creating the state table if it does not already exist
/// - Listing the currently-applied migrations
/// - Applying a single migration file and recording state in one transaction
pub trait MigrationDriver {
    fn ensure_state_table(&mut self) -> Result<()>;
    fn list_applied(&mut self) -> Result<Vec<AppliedMigration>>;
    fn apply_migration(&mut self, file: &MigrationFile) -> Result<()>;
}