drift/extras/migrations_example
Simon Binder 36edcf0ed6
Make getSingle() and watchSingle() non-nullable
2020-12-14 20:22:27 +01:00
..
lib Support raw statements in migration tests (#909) 2020-11-14 12:26:01 +01:00
moor_migrations Add moor-file based table to migration example 2020-11-09 18:55:45 +01:00
test Make getSingle() and watchSingle() non-nullable 2020-12-14 20:22:27 +01:00
README.md Add more docs in the migrations example 2020-10-21 10:33:31 +02:00
build.yaml Add tools to generate old versions of a database 2020-10-14 21:15:17 +02:00
pubspec.yaml Add more docs in the migrations example 2020-10-21 10:33:31 +02:00

README.md

Example to demonstrate tests for schema migrations.

See test/migration_test.dart on how to use the generated verification code.

Workflow

Schema changes

After adapting a schema and incrementing the schemaVersion in the database, run

dart pub run moor_generator schema dump lib/database.dart moor_migrations/moor_schema_v2.json

Replace _v2 with the current schemaVersion.

Generating test code

Run

dart pub run moor_generator schema generate moor_migrations/ test/generated/