migration

package
v0.62.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MigratorDefault = "default"
	MigratorSql     = "sql"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	ID        uint
	Migration string
	Batch     int
}

type Migrator

type Migrator interface {
	// Create a new migration file.
	Create(name string) error
	// Fresh the migrations.
	Fresh() error
	// Reset the migrations.
	Reset() error
	// Rollback the last migration operation.
	Rollback(step, batch int) error
	// Run the migrations according to paths.
	Run() error
	// Status get the migration's status.
	Status() ([]Status, error)
}

type Repository

type Repository interface {
	// CreateRepository Create the migration repository data store.
	CreateRepository() error
	// Delete Remove a migration from the log.
	Delete(migration string) error
	// DeleteRepository Delete the migration repository data store.
	DeleteRepository() error
	// GetLast Get the last migration batch.
	GetLast() ([]File, error)
	// GetMigrations Get the completed migrations.
	GetMigrations() ([]File, error)
	// GetMigrationsByBatch Get the list of the migrations by batch.
	GetMigrationsByBatch(batch int) ([]File, error)
	// GetMigrationsByStep Get the list of migrations.
	GetMigrationsByStep(steps int) ([]File, error)
	// GetNextBatchNumber Get the next migration batch number.
	GetNextBatchNumber() (int, error)
	// GetRan Get the completed migrations.
	GetRan() ([]string, error)
	// Log that a migration was run.
	Log(file string, batch int) error
	// RepositoryExists Determine if the migration repository exists.
	RepositoryExists() bool
}

type Status

type Status struct {
	Name  string
	Batch int
	Ran   bool
}

Jump to

Keyboard shortcuts

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