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

pub type MigrationPlan {
  MigrationPlan(
    name: String,
    operations: List(diff.SchemaOperation),
    statements: List(String),
  )
}

Constructors

pub type MigrationStatus {
  Pending(MigrationPlan)
  Applied(plan: MigrationPlan, record: AppliedMigration)
}

Constructors

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 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)
Search Document