Documentation
¶
Overview ¶
Package migration provides database migration functionality using the goose library. It manages schema evolution by applying pending SQL or Go migrations from a specified directory and tracks migration versions.
Index ¶
Constants ¶
const ( DialectPostgreSQL = goose.DialectPostgres // DialectSqlite3 represents the SQLite3 dialect for migrations. DialectSqlite3 = goose.DialectSQLite3 // DialectClickhouse represents the ClickHouse dialect for migrations. DialectClickhouse = goose.DialectClickHouse )
DialectPostgreSQL represents the PostgreSQL dialect for migrations.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner manages database migrations using the goose library. It applies pending migrations from a specified directory and tracks migration versions.
func NewRunner ¶
NewRunner creates a new migration Runner with the specified dialect, migration directory, and logger.
func (Runner) Run ¶
Run applies all pending migrations to the database. It logs the current database version, lists all migrations with their status, and applies any pending migrations. Returns an error if the migration directory does not exist, migrations cannot be loaded, or if applying migrations fails.