migration

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package migration provides database migration management functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager handles database migrations

func NewManager

func NewManager(db *sql.DB, driver string) *Manager

NewManager creates a new migration manager

func (*Manager) Down

func (m *Manager) Down() error

Down rolls back the last migration

func (*Manager) Register

func (m *Manager) Register(migration Migration)

Register adds a migration to the manager

func (*Manager) Status

func (m *Manager) Status() error

Status shows the status of all migrations

func (*Manager) Up

func (m *Manager) Up() error

Up runs all pending migrations

type Migration

type Migration struct {
	Version     string
	Description string
	Up          func(*sql.DB) error
	Down        func(*sql.DB) error
}

Migration represents a database migration

func GetAll

func GetAll() []Migration

GetAll returns all registered migrations

Jump to

Keyboard shortcuts

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