migrations

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package migrations embeds AuthKit's Postgres schema migrations.

Run them with migratekit (github.com/open-rails/migratekit), the same way host applications do — name-tracked per app in public.migrations, so a recorded migration is never re-applied:

ms, _ := migratekit.LoadFromFS(migrations.FS)
m := migratekit.NewPostgres(sqlDB, "authkit")
_ = m.ApplyMigrations(ctx, ms)

Hosts that configure a non-default schema (core.Config.Schema, authkit issue 69) must run the migrations rendered for that schema instead:

fsys, _ := migrations.FSForSchema("openrails_auth")
ms, _ := migratekit.LoadFromFS(fsys)

Index

Constants

This section is empty.

Variables

View Source
var FS = migrationFS

FS exposes the embedded SQL for external runners. It targets the default "profiles" schema; see FSForSchema for a configurable schema.

Functions

func FSForSchema added in v0.26.0

func FSForSchema(schema string) (fs.FS, error)

FSForSchema returns the embedded migrations rendered for the given schema: every reference to the default "profiles" schema in the DDL (CREATE SCHEMA, qualified table/function names, table_schema string literals) is replaced with the configured name. The schema must match ^[a-z_][a-z0-9_]*$ (max 63 bytes). For "profiles" (or empty) it returns the embedded FS unchanged, so callers can pass core.Service.Schema() unconditionally.

This is a deliberate, validated text substitution performed once at load time — the embedded files themselves are never modified, and the FS export above keeps its historical behavior.

Types

This section is empty.

Jump to

Keyboard shortcuts

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