Documentation
¶
Overview ¶
Package migrate applies versioned SQL migrations to a Popcorn Web database.
Importing this package opts the migration engine into the binary. A host Go build links goose directly; a TinyGo build runs the pw command as a child process instead, because goose is host-only. Both selections expose the same API and behavior.
Index ¶
Constants ¶
const DSNEnv = "PW_MIGRATE_DSN"
DSNEnv carries a database DSN to a delegated pw child process. A DSN is never passed as a process argument.
const DefaultDir = "migrations"
DefaultDir is the project-relative migration directory.
const Delegated = false
Delegated reports whether migration work runs in a pw child process.
Variables ¶
This section is empty.
Functions ¶
func Replay ¶
Replay executes a snapshot produced by Snapshot against an empty database. The script is plain SQL, so this works on every toolchain.
func Snapshot ¶
Snapshot applies every migration to a throwaway database and returns SQL that reproduces the migrated schema, data, and recorded versions.
func SourceHash ¶
SourceHash identifies a migration source tree so callers can cache a snapshot and invalidate it when any migration changes.