migrations

package
v10.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package migrations supplies the work queue table's DDL, rendered for a table prefix.

The platform deliberately does not ship a numbered migration file. Migration files are numbered globally per consumer, so a platform-owned number would collide with the consumer's own the moment either side added one. The version is therefore always the consumer's to choose.

If you already run database/migrate, hand SQL to WithGeneratedMigration and the table is created by your normal migration run — no DDL copied into your repository, nothing to keep in sync as this package evolves:

ddl, err := migrations.SQL(workqueue.DefaultTablePrefix)
// ...
m, err := migrate.New(dialect.Postgres, myMigrations,
	migrate.WithGeneratedMigration(41, "create_work_queue_tables", ddl),
)

Statements is the same DDL split into individually executable statements, for callers running it some other way — a different migration tool, or a test that just wants the table.

One table holds every logical queue: workqueue.Config.Name is the leading column of its primary key, so a second queue needs a second Config, not a second migration.

Postgres only, like the package it serves. Statements and SQL take a dialect anyway, and reject anything else, so a caller wiring this into a dialect-parameterized migration run gets an error naming the dialect rather than a schema that silently renders empty.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SQL

func SQL(d dialect.Dialect, prefix string) (string, error)

SQL renders the same DDL as Statements, joined back into one migration body. It is what you hand to database/migrate's WithGeneratedMigration, so the queue table is created by the consumer's own migration run instead of being copied into their repository.

func Statements

func Statements(d dialect.Dialect, prefix string) ([]string, error)

Statements renders the DDL against the given table prefix and splits it into individually executable statements, the table before its indexes.

func ValidatePrefix

func ValidatePrefix(prefix string) error

ValidatePrefix reports whether prefix yields a legal SQL identifier for every table and index this package creates.

Types

This section is empty.

Jump to

Keyboard shortcuts

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