schemaAt abstract method
Creates a new database and instantiates the schema with the given
version
.
This can be used as a starting point for a complex schema migration test to verify data integrity. You can roughly follow these steps to write such tests:
- call schemaAt with the starting version you want to test
- use the InitializedSchema.rawDatabase of the returned InitializedSchema to insert data.
- connect your database class to a InitializedSchema.newConnection
- call migrateAndValidate with the database and your target schema version to run a migration and verify that it yields the desired schema when done.
- run select statements on your database to verify that the data from step 2 hasn't been affected by the migration.
If you only want to verify the schema without data, using startAt might be easier.
Implementation
Future<InitializedSchema> schemaAt(int version);