migration

package
v1.14.1-0...-8e5426f Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 0 Imported by: 0

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() 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
}

Jump to

Keyboard shortcuts

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