source/core/migration/auto/schema_diff library
The pure, synchronous heart of auto-migration: compare a declared DatumSchema against a store's observed SchemaShape and produce the ColumnOperations that reconcile them.
Classes
- SchemaChange
- One reconciliation step the differ decided on.
- SchemaColumnAdded
- A declared field is missing from the store and will be added (backfilled with its default / null).
- SchemaColumnRemoved
-
A stored column not present in the declaration will be dropped
(only when
autoMigrateDropColumnsis on). - SchemaColumnRenamed
-
A stored column will be renamed to a declared field (via
renamedFrom:). - SchemaRenameOperation
-
A rename that never clobbers: on the map path the value moves only when
the target key is absent (a partially-migrated row keeps its newer
value); on the SQL path it emits
ALTER TABLE … RENAME COLUMNthrough the SqlConvertibleOperation hook.
Constants
-
kReservedColumnNames
→ const Set<
String> -
Column names auto-migration never adds, renames, or drops: the sync core
fields plus anything
__-prefixed (engine-internal, e.g.__typename).
Functions
-
diffSchema<
E extends DatumEntityInterface> ({required DatumSchema< E> schema, required SchemaShape actual, required bool dropRemovedColumns, required bool sqlPath, SqlDialect dialect = SqlDialect.sqlite}) → SchemaDiffResult -
Diffs
schemaagainst the observedactualshape.
Typedefs
-
SchemaDiffResult
= ({List<
SchemaChange> changes, List<ColumnOperation> operations, List<String> warnings}) -
The differ's output: the decided
changes, theoperationsthat execute them (fed into the existing map / SQL migration machinery), and human-readablewarningsfor everything noticed but deliberately not touched.