pgschema

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package pgschema applies PostgreSQL-only schema objects that Ent's schema definitions cannot express, such as expression indexes. Apply it after Ent's migration, and only against PostgreSQL.

Index

Constants

View Source
const HumanEmailIndex = "sf_humans_email_lower_key"

HumanEmailIndex is the unique index on lower(email) in sf_humans. The column's own unique constraint is case-sensitive, while every email lookup is case-insensitive, so this index is what prevents two humans whose emails differ only in case.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, db Execer) error

Apply creates the PostgreSQL-only schema objects. It is idempotent. It fails if existing rows violate an index, for example two humans whose emails differ only in case; resolve those rows and run it again.

Types

type Execer

type Execer interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

Execer runs a statement. *sql.DB, *sql.Tx, and the identity Ent client all satisfy it.

Jump to

Keyboard shortcuts

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