authkitmigrate

package
v0.84.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package authkitmigrate applies AuthKit's embedded Postgres migrations from host code, mirroring rivermigrate's shape:

migrator := authkitmigrate.New(pool, &authkitmigrate.Config{Schema: cfg.Schema})
res, err := migrator.Migrate(ctx)

It is up-only (AuthKit ships no down migrations) and idempotent: tracking is name-based in public.migrations under the canonical "authkit" app key via migratekit, advisory-locked so concurrent replicas are safe. A non-default schema is stamped into the tracking rows, so multiple apps may embed AuthKit in the same database under different schemas without colliding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Schema is the Postgres schema AuthKit's tables live in; it must match
	// embedded.Config.Schema. Empty defaults to "profiles".
	Schema string
}

Config configures a Migrator.

type MigrateResult

type MigrateResult struct {
	// Applied is the migration names applied by THIS call, in order; empty
	// when the database was already current.
	Applied []string
}

MigrateResult reports what a Migrate call did.

type Migrator

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator applies AuthKit's Postgres migrations. Construct with New.

func New

func New(pool *pgxpool.Pool, config *Config) *Migrator

New returns a Migrator over the same pool the host passes to embedded.New. A nil config targets the default "profiles" schema.

func (*Migrator) Migrate

func (m *Migrator) Migrate(ctx context.Context) (*MigrateResult, error)

Migrate applies all pending AuthKit migrations and reports what it applied.

func (*Migrator) Validate

func (m *Migrator) Validate(ctx context.Context) error

Validate returns nil when every AuthKit migration has been applied, and an error naming the pending ones otherwise. Intended for host startup checks.

Jump to

Keyboard shortcuts

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