Expand description
Database migration system. Lives under pg/ with the rest of the
Postgres primitives so the doctrine “all PG-touching code goes through
forge_runtime::pg” is enforced by layout, not just by convention.
§Migration types
- System migrations: internal Forge schema, versioned as
__forge_vXXX. Applied before user migrations so new framework features can ship without conflicting with user migration numbering. - User migrations: application schema, named
XXXX_name.sql. Sorted alphabetically and applied after system migrations.
Structs§
- Applied
Migration - Information about an applied migration.
- Migration
- A single migration with up SQL.
- Migration
Config - Tunable knobs for the migration runner. Defaults match the deploy-friendly values: bounded lock-acquire wait so a stuck lock fails CI loudly instead of hanging silently.
- Migration
Runner - Migration runner that handles both built-in and user migrations.
- Migration
Status - Status of migrations.
- System
Migration - A system migration with a version number.
Enums§
- Drift
Status - Whether the on-disk source for an already-applied migration still matches the checksum recorded at apply time.
Constants§
- SYSTEM_
MIGRATION_ PREFIX - System migration prefix. All forge internal migrations use this prefix.
Functions§
- extract_
version - Returns
Noneifnameis not a valid system migration name. - get_
all_ system_ sql - All system SQL concatenated. Use for test setup; production code should use
get_builtin_migrations. - get_
builtin_ migrations - get_
system_ migrations - All built-in FORGE system migrations in version order.
- is_
system_ migration - load_
migrations_ from_ dir - Load user migrations from a directory.