migrate

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyDiff

func ApplyDiff(db *sql.DB, results []DiffResult) error

ApplyDiff executes the generated ALTER TABLE statements against the database.

Types

type DiffResult

type DiffResult struct {
	Table      string
	Statements []string
}

DiffResult holds the generated SQL for one model.

func Diff

func Diff(db *sql.DB, driver string, models ...any) ([]DiffResult, error)

Diff compares Go struct models against the live database schema and returns ALTER TABLE statements for any columns that are present in the struct but missing from the database table. The driver parameter must match the active database driver (e.g. "mysql", "postgres", "sqlite", "cockroachdb").

Jump to

Keyboard shortcuts

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