Documentation
¶
Index ¶
- func Migrate(pool *pgxpool.Pool, lg *zap.Logger, schema string, migrations ...fs.FS) error
- type AddCheck
- type AddColumn
- type AddExtension
- type AddForeignKey
- type AddFunction
- type AddIndex
- type AddPolicy
- type AddSchema
- type AddTable
- type AddTrigger
- type Change
- type Check
- type Column
- type Differ
- type DisableRLS
- type DropCheck
- type DropColumn
- type DropExtension
- type DropForeignKey
- type DropFunction
- type DropIndex
- type DropPolicy
- type DropSchema
- type DropTable
- type DropTrigger
- type EnableRLS
- type Extension
- type ForceRLS
- type ForeignKey
- type Function
- type FunctionArg
- type Identity
- type Index
- type IndexColumn
- type Inspector
- type Migrator
- type ModifyColumn
- type ModifyFunction
- type ModifyIndex
- type ModifyPolicy
- type ModifyTable
- type ModifyTrigger
- type Plan
- type PlannedChange
- type Planner
- type Policy
- type Schema
- type SchemaState
- type Table
- type Trigger
- type UnforceRLS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddForeignKey ¶ added in v0.4.0
type AddForeignKey struct{ FK *ForeignKey }
Foreign key changes
type AddTrigger ¶ added in v0.4.0
Trigger changes
type Change ¶ added in v0.4.0
type Change interface {
// contains filtered or unexported methods
}
Change represents a schema change.
type Differ ¶ added in v0.4.0
type Differ interface {
Diff(current, desired *SchemaState) ([]Change, error)
}
Differ compares two schema states and returns changes.
type DisableRLS ¶ added in v0.4.0
type DisableRLS struct{ Table string }
type DropColumn ¶ added in v0.4.0
type DropColumn struct{ C *Column }
type DropExtension ¶ added in v0.4.0
type DropExtension struct{ E *Extension }
type DropForeignKey ¶ added in v0.4.0
type DropForeignKey struct{ FK *ForeignKey }
type DropFunction ¶ added in v0.4.0
type DropFunction struct{ F *Function }
type DropPolicy ¶ added in v0.4.0
type DropSchema ¶ added in v0.4.0
type DropSchema struct{ S *Schema }
type DropTrigger ¶ added in v0.4.0
type ForeignKey ¶ added in v0.4.0
type FunctionArg ¶ added in v0.4.0
type IndexColumn ¶ added in v0.4.0
type Inspector ¶ added in v0.4.0
type Inspector interface {
InspectSchema(ctx context.Context, name string) (*Schema, error)
InspectRealm(ctx context.Context) (*SchemaState, error)
}
Inspector inspects the current state of a database.
type Migrator ¶ added in v0.4.0
type Migrator interface {
Inspector
Differ
Planner
Lock(ctx context.Context, name string, timeout time.Duration) (unlock func() error, err error)
}
Migrator is the full migration engine interface.
type ModifyColumn ¶ added in v0.4.0
type ModifyFunction ¶ added in v0.4.0
type ModifyIndex ¶ added in v0.4.0
type ModifyPolicy ¶ added in v0.4.0
type ModifyTable ¶ added in v0.4.0
type ModifyTrigger ¶ added in v0.4.0
type Plan ¶ added in v0.4.0
type Plan struct {
Name string
Changes []PlannedChange
}
Plan is a generated migration.
type PlannedChange ¶ added in v0.4.0
type PlannedChange struct {
SQL string // DDL statement
Comment string // Human-readable description
Reverse string // Rollback statement (if possible)
}
PlannedChange is a single DDL statement in a migration.
type SchemaState ¶ added in v0.4.0
type SchemaState struct {
Schemas []Schema
}
SchemaState represents the full state of a database realm.
type UnforceRLS ¶ added in v0.4.0
type UnforceRLS struct{ Table string }
Click to show internal directories.
Click to hide internal directories.