migrate

package
v1.161.0 Latest Latest
Warning

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

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

Documentation

Overview

Package migrate provides database migration support using golang-migrate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Down

func Down(db *sql.DB) error

Down rolls back all migrations. Use with caution - this will destroy all data.

func Run

func Run(db *sql.DB) error

Run executes all pending database migrations. It applies migrations in order and is idempotent - already applied migrations are skipped.

func Steps

func Steps(db *sql.DB, n int) error

Steps applies n migrations (positive = up, negative = down).

func Version

func Version(db *sql.DB) (version uint, dirty bool, err error)

Version returns the current migration version.

Types

type DevRename added in v1.159.0

type DevRename struct {
	Site string
	// Domains is the environment's hostnames, comma-separated.
	Domains string
	// NewName is the name 000239 gives it.
	NewName string
}

DevRename is a site whose environment named dev has a domain, which migration 000239 is about to rename (#2608).

func PendingDevRenames added in v1.159.0

func PendingDevRenames(ctx context.Context, db *sql.DB) ([]DevRename, error)

PendingDevRenames is each site whose dev environment has a domain and that 000239 will rename, read before the migrations run so the operator is told the one time it can be. None when the schema's version cannot be read (a new database), is dirty, or is one 000239 does not apply to: before the site tables exist, or once it has run.

type PublicLoss added in v1.159.0

type PublicLoss struct {
	Site        string
	Environment string
}

PublicLoss is an environment public before 000245 with no domain, which 000245 makes answer only to someone signed in (#2619).

func PendingPublicLosses added in v1.159.0

func PendingPublicLosses(ctx context.Context, db *sql.DB) ([]PublicLoss, error)

PendingPublicLosses is each environment 000245 will stop answering anonymously, read before the migrations run so the operator is told the one time it can be. None when the schema's version cannot be read, is dirty, or is one 000245 does not apply to.

Jump to

Keyboard shortcuts

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