Expand description
Model-change migration diffing (ADR-011 revision).
The checked-in migration SQL is the schema of record: we parse the columns a table
already has from its generated .sql files (never touching a live database), diff them
against the fields declared for the module in gize.toml, and emit the ALTER TABLE
needed to reconcile. Additive changes (new columns) are safe and generated automatically;
destructive ones (dropping a column) are gated behind --force, and a rename — which at
the column level is indistinguishable from a drop plus an add — is always surfaced for a
human to decide rather than inferred.
Structs§
- Schema
Diff - The schema delta between a module’s declared fields and its migrated columns.
Functions§
- alter_
sql - Render an
ALTER TABLEmigration that reconcilestableto its declared shape. - diff_
model - Compute the diff for
model(a module’s declared shape) against the columns already present in its table’s generated migrations undermigrations_dir. - known_
columns - The set of column names a table already has, parsed from every generated migration that
touches it (
*_create_<table>.sqland anyALTER TABLE <table> ADD COLUMN). ReturnsNoneif the table has no create migration yet.