sqlmigrate

package
v0.0.0-...-55361dd Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const CobraMigrateDownShort = "" /* 149-byte string literal not displayed */
View Source
const CobraMigrateDownUse = "down n"
View Source
const CobraMigrateStatusShort = "Get database schema migration status"
View Source
const CobraMigrateStatusUse = "status"
View Source
const CobraMigrateUpShort = "Migrate at most n versions up. When n is omitted, migrate to latest version. n must be a positive integer."
View Source
const CobraMigrateUpUse = "up [n]"

Variables

View Source
var CobraMigrateDownArgs = cobra.ExactArgs(1)
View Source
var CobraMigrateStatusArgs = cobra.ExactArgs(0)
View Source
var CobraMigrateUpArgs = cobra.MaximumNArgs(1)

Functions

func CobraParseMigrateDownArgs

func CobraParseMigrateDownArgs(args []string) (n int, err error)

func CobraParseMigrateUpArgs

func CobraParseMigrateUpArgs(args []string) (n int, err error)

Types

type ConnectionOptions

type ConnectionOptions struct {
	DatabaseURL    string
	DatabaseSchema string
}

type MigrationSet

type MigrationSet struct {
	MigrationSet                         migrate.MigrationSet
	EmbedFS                              embed.FS
	EmbedFSRoot                          string
	OutputPathRelativeToWorkingDirectory string
}

func NewMigrateSet

func NewMigrateSet(options NewMigrationSetOptions) MigrationSet

func (MigrationSet) Create

func (s MigrationSet) Create(name string) (fileName string, err error)

func (MigrationSet) Down

func (s MigrationSet) Down(opts ConnectionOptions, max int) (n int, err error)

func (MigrationSet) Status

func (s MigrationSet) Status(opts ConnectionOptions) (plans []*migrate.PlannedMigration, err error)

func (MigrationSet) Up

func (s MigrationSet) Up(opts ConnectionOptions, max int) (n int, err error)

type NewMigrationSetOptions

type NewMigrationSetOptions struct {
	// TableName is the name of the table that stores migration status.
	TableName string

	// EmbedFS is a embed.FS that stores migration files.
	// You also pass in a correct EmbedFSRoot to tell where to find the migrations.
	// Suppose you write //go:embed migrations/authgear
	// then EmbedFSRoot MUST BE "migrations/authgear" (no leading slash nor trailing slash)
	EmbedFS     embed.FS
	EmbedFSRoot string

	// OutputPathRelativeToWorkingDirectory is for the create command.
	// The create command create new file in the actual filesystem, so
	// it is relative to workdir.
	OutputPathRelativeToWorkingDirectory string
}

type PartmanMaintainer

type PartmanMaintainer struct {
	DatabaseURL    string
	DatabaseSchema string
	TableName      string
}

func (PartmanMaintainer) RunMaintenance

func (m PartmanMaintainer) RunMaintenance() (err error)

type TemplateMigrationSource

type TemplateMigrationSource struct {
	OriginSource migrate.MigrationSource
	Data         interface{}
}

func (TemplateMigrationSource) ExecuteTemplate

func (s TemplateMigrationSource) ExecuteTemplate(input string) (out string, err error)

func (TemplateMigrationSource) FindMigrations

func (s TemplateMigrationSource) FindMigrations() (migrations []*migrate.Migration, err error)

Jump to

Keyboard shortcuts

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