cmd

package
v0.0.0-...-d56b225 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

README

CMD Package

Running Tests

# Run all tests in cmd package
go test -v ./cmd/...

# Plan and apply tests (CLI integration tests)
go test -v ./cmd/ -run "TestPlanAndApply"

# If we change the plan generation logic, we may need to regenerate the test case plan.[json|sql|txt]
go test -v ./cmd/ -run "TestPlanAndApply" --generate

# Run a specific test case
PGSCHEMA_TEST_FILTER="create_table/add_column_identity" go test -v ./cmd -run TestPlanAndApply

# Include command tests
go test -v ./cmd/ -run "TestIncludeIntegration"

# Root command tests
go test -v ./cmd/ -run "TestRoot"

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GitCommit = "unknown"
	BuildDate = "unknown"
)

Build-time variables set via ldflags

View Source
var Debug bool
View Source
var RootCmd = &cobra.Command{
	Use:   "pgschema",
	Short: "Declarative schema migration for Postgres",
	Long: fmt.Sprintf(`Declarative schema migration for Postgres

Version: %s@%s %s %s

Commands:
  dump    Dump PostgreSQL schema
  plan    Generate migration plan
  apply   Apply schema migrations

Use "pgschema [command] --help" for more information about a command.`,
		version.App(), GitCommit, platform(), BuildDate),
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		setupLogger()
		globallogger.SetGlobal(logger, Debug)
	},
}

Functions

func Execute

func Execute()

func GetLogger

func GetLogger() *slog.Logger

GetLogger returns the global logger instance

func IsDebug

func IsDebug() bool

IsDebug returns whether debug mode is enabled

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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