migrate

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsDestructiveChange

func ContainsDestructiveChange(sql string) bool

ContainsDestructiveChange checks if SQL contains any destructive operations.

func DestructiveWarning

func DestructiveWarning(changes []string) string

DestructiveWarning generates a formatted warning message for destructive changes.

func Diff

func Diff(cfg Config, name string, force bool) (string, error)

Diff generates a new migration by comparing the current schema with the target schema. If force is false and the migration contains destructive changes, returns an error.

func Down

func Down(cfg Config) (string, error)

Down rolls back the last applied migration.

func FindDestructiveChanges

func FindDestructiveChanges(sql string) []string

FindDestructiveChanges returns all lines containing destructive operations.

func Hash

func Hash(cfg Config) error

Hash recomputes the atlas.sum checksum file after manual migration edits.

func Status

func Status(cfg Config) (string, error)

Status shows the current migration state.

func Up

func Up(cfg Config) (string, error)

Up applies pending migrations to the database.

Types

type Config

type Config struct {
	AtlasBin     string // Path to atlas binary
	MigrationDir string // Path to migrations/ directory
	SchemaURL    string // Path to gen/atlas/schema.hcl (file:// URL)
	DatabaseURL  string // PostgreSQL connection URL
	DevURL       string // Dev database URL for atlas diff
}

Config holds the configuration for Atlas CLI commands.

Jump to

Keyboard shortcuts

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