SqlMigrationExecutor<T extends DatumEntityInterface> class

Runs SchemaMigrations natively on a SQL store through the adapter's RawQueryCapable.rawQuery — the SQL twin of the map-based MigrationExecutor.

Where the map-based executor rewrites every row through the entity's serialization round-trip (right for schemaless stores like Hive or in-memory), this executor emits ALTER TABLE/UPDATE statements so the database changes its own schema — the only way columns can actually be added or dropped on a SQL table.

Every statement for the whole chain is generated (and therefore validated) up front, and the plan is checked with MigrationPlan.resolve, so nothing touches the database unless the entire migration is expressible. Execution runs inside LocalAdapter.transaction; atomicity is the adapter's — SQLite and PostgreSQL both roll back DDL+DML together.

Constructors

SqlMigrationExecutor({required LocalAdapter<T> localAdapter, required String table, required List<SchemaMigration> migrations, required int targetVersion, required DatumLogger logger, SqlDialect dialect = SqlDialect.sqlite})

Properties

generator SqlMigrationGenerator
final
hashCode int
The hash code for this object.
no setterinherited
localAdapter LocalAdapter<T>
final
logger DatumLogger
final
migrations List<SchemaMigration>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
table String
final
targetVersion int
final

Methods

execute() Future<MigrationResult>
Resolves, translates, and executes the migration chain.
needsMigration() Future<bool>
Whether the stored schema version is behind targetVersion.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited