galchemy/schema/migration/postgres
Types
pub type AppliedMigration {
AppliedMigration(
name: String,
applied_at: String,
statement_count: Int,
)
}
Constructors
-
AppliedMigration( name: String, applied_at: String, statement_count: Int, )
pub type ApplyError {
AlreadyApplied(String)
HistoryQueryError(pog.QueryError)
StatementError(statement: String, error: pog.QueryError)
RecordError(pog.QueryError)
}
Constructors
-
AlreadyApplied(String) -
HistoryQueryError(pog.QueryError) -
StatementError(statement: String, error: pog.QueryError) -
RecordError(pog.QueryError)
pub type MigrationPlan {
MigrationPlan(
name: String,
operations: List(diff.SchemaOperation),
statements: List(String),
)
}
Constructors
-
MigrationPlan( name: String, operations: List(diff.SchemaOperation), statements: List(String), )
pub type MigrationStatus {
Pending(MigrationPlan)
Applied(plan: MigrationPlan, record: AppliedMigration)
}
Constructors
-
Pending(MigrationPlan) -
Applied(plan: MigrationPlan, record: AppliedMigration)
Values
pub fn applied_migration_query(
name: String,
) -> pog.Query(AppliedMigration)
pub fn apply(
connection: pog.Connection,
plan: MigrationPlan,
) -> Result(Nil, pog.TransactionError(ApplyError))
pub fn ensure_history_table_query() -> pog.Query(Nil)
pub fn history_query() -> pog.Query(AppliedMigration)
pub fn plan(
name: String,
current: model.SchemaSnapshot,
target: model.SchemaSnapshot,
) -> Result(MigrationPlan, postgres.DdlCompileError)
pub fn record_migration_query(
plan: MigrationPlan,
) -> pog.Query(Nil)
pub fn statuses(
plans: List(MigrationPlan),
applied: List(AppliedMigration),
) -> List(MigrationStatus)