Skip to main content

Module diff

Module diff 

Source
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§

SchemaDiff
The schema delta between a module’s declared fields and its migrated columns.
SchemaHistory
One immutable replay shared by every module in a CLI invocation.
TypeChange

Functions§

alter_sql
Render an ALTER TABLE migration that reconciles table to 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 under migrations_dir.
known_columns
The current columns after replaying forward migrations (PostgreSQL compatibility helper).
known_columns_for_dialect
Replay columns using the selected dialect (including MySQL quoted identifiers).