Documentation
¶
Overview ¶
Package migrate embeds ulinzilib-go's "security"-schema goose migrations and applies them to a PostgreSQL database.
It is an OPTIONAL, standalone package. The core packages (ulinzi and its postgres adapter) import neither embed nor goose, so nothing on the request path links a migration tool. Import this package ONLY from your migrator entrypoint (a dedicated cmd/migrate binary, or a one-shot step at startup) — never from a request handler.
Schema ownership: this library OWNS the "security" schema (a faithful port of the .NET security library InitialSecuritySchema), so it ships the schema's migrations with the code that depends on them. Your application still owns its OWN (app) schema and decides WHEN these run relative to its own migrations.
In the shared-DB unified-SSO deployment the .NET service owns the schema instead — do NOT run these migrations there (goose and EF Core must not both own one schema).
The caller supplies a *sql.DB and is responsible for registering a driver, e.g. a blank import of github.com/jackc/pgx/v5/stdlib (driver name "pgx").
import (
"database/sql"
_ "github.com/jackc/pgx/v5/stdlib"
"github.com/Cyrus-0101/ulinzilib-go/migrate"
)
db, _ := sql.Open("pgx", os.Getenv("DATABASE_URL"))
defer db.Close()
if err := migrate.Up(db); err != nil { log.Fatal(err) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FS embed.FS
FS holds the embedded "security"-schema migration files (goose SQL). It is exported so callers who prefer their own tooling can read the .sql directly (e.g. via io/fs); the files live under the "migrations" directory.
Functions ¶
Types ¶
This section is empty.