cli

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cli provides a command-line interface for Queen migrations.

Index

Constants

View Source
const (
	DriverPostgres   = "postgres"
	DriverPostgreSQL = "postgresql"
	DriverMySQL      = "mysql"
	DriverSQLite     = "sqlite"
	DriverSQLite3    = "sqlite3"
	DriverClickHouse = "clickhouse"

	SQLDriverPostgres   = "pgx"
	SQLDriverMySQL      = "mysql"
	SQLDriverSQLite     = "sqlite3"
	SQLDriverClickHouse = "clickhouse"
)
View Source
const DefaultTableName = "queen_migrations"

Variables

This section is empty.

Functions

func Run

func Run(register RegisterFunc)

Run starts the CLI with the given migration registration function.

func RunWithDB

func RunWithDB(register RegisterFunc, dbOpener DBOpener)

RunWithDB starts the CLI with a custom database opener.

Types

type App

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

App holds the CLI application state.

type Config

type Config struct {
	Driver      string        `yaml:"driver"`
	DSN         string        `yaml:"dsn"`
	Table       string        `yaml:"table"`
	LockTimeout time.Duration `yaml:"lock_timeout"`

	UseConfig        bool   `yaml:"-"`
	Env              string `yaml:"-"`
	UnlockProduction bool   `yaml:"-"`
	Yes              bool   `yaml:"-"`
	JSON             bool   `yaml:"-"`
	Verbose          bool   `yaml:"-"`
	// contains filtered or unexported fields
}

Config holds all configuration options for the CLI.

type ConfigFile

type ConfigFile struct {
	ConfigLocked bool                    `yaml:"config_locked"`
	Naming       *NamingConfig           `yaml:"naming"`
	Environments map[string]*Environment `yaml:",inline"`
}

ConfigFile represents the structure of .queen.yaml

type DBOpener

type DBOpener func(dsn string) (*sql.DB, error)

DBOpener is a function that opens a database connection.

type DoctorResult added in v0.3.0

type DoctorResult struct {
	Check    string `json:"check"`
	Status   string `json:"status"` // "statusPass", "statusWarning", "statusFail"
	Message  string `json:"message"`
	Details  string `json:"details,omitempty"`
	Severity string `json:"severity,omitempty"`
}

DoctorResult represents a health check result.

type Environment

type Environment struct {
	Driver                string        `yaml:"driver"`
	DSN                   string        `yaml:"dsn"`
	Table                 string        `yaml:"table"`
	LockTimeout           time.Duration `yaml:"lock_timeout"`
	RequireConfirmation   bool          `yaml:"require_confirmation"`
	RequireExplicitUnlock bool          `yaml:"require_explicit_unlock"`
}

Environment represents a single environment configuration.

type NamingConfig added in v0.2.0

type NamingConfig struct {
	Pattern string `yaml:"pattern"`
	Padding int    `yaml:"padding"`
	Enforce *bool  `yaml:"enforce"`
}

NamingConfig represents naming pattern configuration in YAML.

type RegisterFunc

type RegisterFunc func(*queen.Queen)

RegisterFunc is a function that registers migrations with Queen.

Directories

Path Synopsis
Package tui provides a terminal UI for Queen migrations.
Package tui provides a terminal UI for Queen migrations.

Jump to

Keyboard shortcuts

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