schema

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseManager

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

BaseManager provides common schema management functionality

func NewBaseManager

func NewBaseManager() *BaseManager

NewBaseManager creates a new base schema manager

func (*BaseManager) EnsureVersionTable

func (m *BaseManager) EnsureVersionTable(ctx context.Context, db *sql.DB) error

EnsureVersionTable creates the schema version table if it doesn't exist

func (*BaseManager) GetVersion

func (m *BaseManager) GetVersion(ctx context.Context, db *sql.DB) (uint, bool, error)

GetVersion retrieves the current schema version

func (*BaseManager) SetVersion

func (m *BaseManager) SetVersion(ctx context.Context, db *sql.DB, version uint, description string) error

SetVersion records a new schema version

type Manager

type Manager interface {
	// Initialize creates the initial schema if it doesn't exist
	Initialize(ctx context.Context, db *sql.DB) error
	// Migrate runs migrations to bring schema to target version
	Migrate(ctx context.Context, db *sql.DB, targetVersion uint) error
	// Version returns the current schema version
	Version(ctx context.Context, db *sql.DB) (uint, bool, error)
	// Validate checks that the schema is in a valid state
	Validate(ctx context.Context, db *sql.DB) error
}

Manager handles schema initialization and migrations for SQL storage backends. Each backend (SQLite, Postgres) implements this interface.

Jump to

Keyboard shortcuts

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