migrate

package
v0.333.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package migrate supports a dbmate-compatible superset of migration files.

The superset is that in addition to a migration being a .sql file, it can also be a Go function which is called to execute the migration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(ctx context.Context, db *sql.DB, migrationFiles fs.FS, options ...Option) error

Migrate applies all migrations in the provided fs.FS and migration functions to the provided database.

Types

type MigrationFunc added in v0.328.4

type MigrationFunc func(ctx context.Context, db *sql.Tx) error

type Option added in v0.328.4

type Option func(*migrateOptions)

Option is a configuration option for Migrate.

func LogLevel added in v0.328.4

func LogLevel(level log.Level) Option

LogLevel sets the loggging level of the migrator.

func Migration

func Migration(version, name string, migration MigrationFunc) Option

Migration adds a named migration function to the migration set.

"version" must be in the form "<YYYY><MM><DD><hh><mm><ss>".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL