migrations

package
v0.0.0-...-89c9057 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateDB

func CreateDB(ctx context.Context, conn clickhouse.Conn, dbName string) error

func NewMigration

func NewMigration(tmpl string, data any, filename string) (*goose.Migration, error)

NewMigration creates a new migration from a Go template tmpl. The data is passed to the template as the arguments. The filename is used to name the template and build the migration number.

func RunGooseMigrations

func RunGooseMigrations(ctx context.Context, dsn, dbName string, migrations []*goose.Migration, devMode bool) error

Types

type RenderFunc

type RenderFunc func(selfHosted bool, devel bool) (*goose.Migration, error)

type RenderFuncs

type RenderFuncs []RenderFunc

func (RenderFuncs) Render

func (r RenderFuncs) Render(selfHosted bool, devel bool) ([]*goose.Migration, error)

type TemplateData

type TemplateData struct {
	// DatabaseName is the name of the database where migrations are running.
	// All migrations should act on this database.
	DatabaseName string
	// SelfHostedVersion is true if the migrations are running on a self-hosted.
	// This will be removed when the tenant-operator is removed.
	SelfHostedVersion bool

	// If DevelopmentMode is true then the underlying migrations are executed on a non-replicated table engine.
	// This flag is mutually exclusive with `SelfHostedVersion` as we expect them to run on a replicated table engine.
	DevelopmentMode bool
}

TemplateData is has standard fields passed to every migration template. Embed this in a struct type to use these fields with other ones in a template. e.g.

type MyTemplateData struct {
    migrations.TemplateData
    MyField string
}

You cannot embed any or interface{} types as the fields will not be accessible to the template.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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