migrations

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAuthSchemaChecks = []AuthSchemaCheck{
	{
		Table: "users",
		Columns: []string{
			"id",
			"email",
			"username",
			"status",
		},
	},
	{
		Table: "password_reset",
		Columns: []string{
			"id",
			"user_id",
			"email",
			"status",
			"jti",
			"issued_at",
			"expires_at",
			"used_at",
			"scope_tenant_id",
			"scope_org_id",
		},
	},
}

DefaultAuthSchemaChecks captures the minimal columns go-users expects on auth tables.

Functions

func Filesystems

func Filesystems() []fs.FS

Filesystems returns a copy of all registered migration filesystems.

func Register

func Register(fsys fs.FS)

Register records a filesystem that contains go-users migrations. Callers can then feed all registered filesystems into go-persistence-bun (or any other runner) via Filesystems().

func ValidateAuthSchema added in v0.12.0

func ValidateAuthSchema(ctx context.Context, db *sql.DB, dialect string, opts ...AuthSchemaOption) error

ValidateAuthSchema ensures auth-owned tables expose columns go-users relies on.

Types

type AuthSchemaCheck added in v0.12.0

type AuthSchemaCheck struct {
	Table   string
	Columns []string
}

AuthSchemaCheck describes a table/column requirement for auth-backed schemas.

type AuthSchemaOption added in v0.12.0

type AuthSchemaOption func(*authSchemaConfig)

AuthSchemaOption customizes auth schema validation.

func WithAuthSchemaChecks added in v0.12.0

func WithAuthSchemaChecks(checks []AuthSchemaCheck) AuthSchemaOption

WithAuthSchemaChecks replaces the default checks with a custom list.

type AuthSchemaValidationError added in v0.12.0

type AuthSchemaValidationError struct {
	MissingTables  []string
	MissingColumns map[string][]string
}

AuthSchemaValidationError summarizes missing auth tables/columns.

func (*AuthSchemaValidationError) Error added in v0.12.0

func (e *AuthSchemaValidationError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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