migrations

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Unlicense Imports: 6 Imported by: 0

Documentation

Overview

Package migrations runs versioned schema migrations against the relay package's embedded bbolt key-value store, tracking the applied version in a dedicated bucket.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Bucket to store migration version
	MIGRATIONS_BUCKET = []byte("_migrations")
	// Key to store the current version
	VERSION_KEY = []byte("version")
)

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager(db *bolt.DB, opts ...ManagerOption) *Manager

func (*Manager) GetCurrentVersion

func (m *Manager) GetCurrentVersion() (uint64, error)

func (*Manager) Register

func (m *Manager) Register(migration Migration)

func (*Manager) Run

func (m *Manager) Run() error

func (*Manager) SetVersion

func (m *Manager) SetVersion(tx *bolt.Tx, version uint64) error

type ManagerOption added in v0.2.2

type ManagerOption func(*Manager)

ManagerOption mutates a Manager at construction time.

func WithLogger added in v0.2.2

func WithLogger(logger zerolog.Logger) ManagerOption

WithLogger configures the logger used for migration progress logging. Defaults to zerolog.Nop() (silent).

type Migration

type Migration interface {
	Version() uint64
	Description() string
	Up(tx *bolt.Tx) error
	Down(tx *bolt.Tx) error
}

type ResetVerificationCacheMigration

type ResetVerificationCacheMigration struct {
	MetricsBucket []byte
}

func (*ResetVerificationCacheMigration) Description

func (m *ResetVerificationCacheMigration) Description() string

func (*ResetVerificationCacheMigration) Down

func (*ResetVerificationCacheMigration) Up

func (*ResetVerificationCacheMigration) Version

Jump to

Keyboard shortcuts

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