pub fn classify_schema_update(
old_fields: &[FieldDef],
old_indexes: &[IndexDef],
new_fields: &[FieldDef],
new_indexes: &[IndexDef],
) -> Result<SchemaChange, DbError>Expand description
Classify a schema update from (old_fields, old_indexes) to (new_fields, new_indexes).
Policy (v0.9.0, conservative):
- Existing fields must remain present and type-compatible.
- Enum fields may add variants (superset) but may not remove variants.
- Constraints must be identical for existing fields (tightening is treated as breaking).
- New fields are
Safeonly if they are top-level-absent-compatible (Optional); otherwiseNeedsMigration. - Existing indexes must remain unchanged; adding indexes is
SafeforNonUniqueandNeedsMigrationforUnique.