Documentation
¶
Overview ¶
Package migrations embeds the SQL migration files for the kagent database schema and provides the runner that applies them at startup.
Index ¶
- Variables
- func RunUp(ctx context.Context, config *pgxpool.Config, sources []Source) error
- func VerifyMigrated(ctx context.Context, config *pgxpool.Config, sources []Source) error
- func Versions(src Source) ([]int64, error)
- func WithProvider(ctx context.Context, config *pgxpool.Config, src Source, ...) (retErr error)
- type Source
Constants ¶
This section is empty.
Variables ¶
var FS embed.FS
Functions ¶
func RunUp ¶
RunUp applies all pending migrations in source order. Each source migrates on its own pool built from config, with the source's schema as its search path.
func VerifyMigrated ¶
VerifyMigrated checks migration state without database writes.
Types ¶
type Source ¶
type Source struct {
Name string
Schema string
VectorSchema string
TrackingTable string
FS fs.FS
Dir string
// PreCheck runs before any source migrates, on a pool that uses the
// caller's configuration rather than this source's search path.
PreCheck func(ctx context.Context, pool *pgxpool.Pool) error
}
Source describes one migration source. Schema is required: the source's tables and tracking table live there.
func BuiltinSources ¶
BuiltinSources returns the built-in migration sources in the default schemas.
func BuiltinSourcesInSchema ¶
BuiltinSourcesInSchema returns the built-in sources with their table and pgvector schemas selected independently. Empty values use the defaults.