migrateAndValidate abstract method
Runs a schema migration and verifies that it transforms the database into a correct state.
This involves opening the db
and calling its
GeneratedDatabase.migration
to migrate it to the latest version.
Finally, the method will read from sqlite_schema
to verify that the
schema at runtime matches the expected schema version.
The future completes normally if the schema migration succeeds and brings the database into the expected schema. If the comparison fails, a SchemaMismatch exception will be thrown.
If validateDropped
is enabled (defaults to false
), the method also
validates that no further tables, triggers or views apart from those
expected exist.
Implementation
Future<void> migrateAndValidate(GeneratedDatabase db, int expectedVersion,
{bool validateDropped = false});