Help us shape the future of Go! Take the 2026 Go Developer Survey

migrations

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const InitialSchemaName = "2026090101"

Bun stores the numeric migration name and derives "initial_schema" as its human-readable comment from the filename.

Variables

View Source
var ErrIncompatibleDatabase = errors.New("database contains an incompatible SynapS3 schema")
View Source
var Migrations = func() *migrate.Migrations {
	registry, err := discoverMigrations(sqlMigrations)
	if err != nil {
		panic(err)
	}
	return registry
}()

Migrations is the global registry of database migrations.

Functions

func NewMigrator

func NewMigrator(db *bun.DB) *migrate.Migrator

NewMigrator is the only supported migrator constructor. Migration markers are written only after the corresponding body succeeds.

func ValidateTarget

func ValidateTarget(ctx context.Context, db bun.IDB) error

ValidateTarget refuses, before anything is written, a database that is not this application's: its recorded migrations must be an ordered prefix of the registry. Without a recorded migration, only an empty target or a complete baseline with initialized migration metadata is accepted. Whether migrations build the intended schema is verified by tests, not here.

Types

This section is empty.

Jump to

Keyboard shortcuts

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