migrate

package
v1.0.0-beta.226 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

A very lightweigh migration tool to replace `ent.Schema.Create` calls.

Index

Constants

View Source
const IgnoreMarker = "-- migration:ignore"
View Source
const (
	MigrationsTable = "schema_om"
)

Variables

View Source
var ErrNoChange = migrate.ErrNoChange
View Source
var OMMigrationsConfig = MigrationsConfig{
	FS:             omMigrations,
	FSPath:         "migrations",
	StateTableName: MigrationsTable,
}

Functions

func NewLogger

func NewLogger(log *slog.Logger) migrate.Logger

Types

type FS

type FS interface {
	fs.ReadDirFS
	fs.ReadFileFS
}

type Migrate

type Migrate struct {
	// contains filtered or unexported fields
}

func New

func New(options MigrateOptions) (*Migrate, error)

New creates a new migrate instance.

func (*Migrate) CloseOrLogError

func (m *Migrate) CloseOrLogError()

func (*Migrate) Down

func (m *Migrate) Down() error

func (*Migrate) LatestVersion

func (m *Migrate) LatestVersion() (uint, error)

func (*Migrate) Migrate

func (m *Migrate) Migrate(version uint) error

func (*Migrate) Up

func (m *Migrate) Up() error

func (*Migrate) WaitForMigrationJob

func (m *Migrate) WaitForMigrationJob(waitOpts ...WaitForMigrationOption) error

type MigrateOptions

type MigrateOptions struct {
	ConnectionString string
	Migrations       MigrationsConfig
	Logger           *slog.Logger
}

func (*MigrateOptions) Validate

func (m *MigrateOptions) Validate() error

type MigrationsConfig

type MigrationsConfig struct {
	FS             fs.FS
	FSPath         string
	StateTableName string
}

func (*MigrationsConfig) Validate

func (m *MigrationsConfig) Validate() error

type SourceWrapper

type SourceWrapper struct {
	// contains filtered or unexported fields
}

func NewSourceWrapper

func NewSourceWrapper(fsys fs.FS) *SourceWrapper

func (*SourceWrapper) Open

func (s *SourceWrapper) Open(name string) (fs.File, error)

func (*SourceWrapper) ReadDir

func (s *SourceWrapper) ReadDir(path string) ([]fs.DirEntry, error)

func (*SourceWrapper) ReadFile

func (s *SourceWrapper) ReadFile(name string) ([]byte, error)

type WaitForMigrationOption

type WaitForMigrationOption func(*waitForMigrationOptions)

Jump to

Keyboard shortcuts

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