drift/extras/migrations_example
Simon Binder 5848a8e942
Re-generate schema files
2021-06-01 11:38:08 +02:00
..
lib Migrate migrations example to null-safety 2021-03-09 21:52:46 +01:00
moor_migrations Add Dart default value to generated schema (#1018) 2021-01-27 22:10:34 +01:00
test Re-generate schema files 2021-06-01 11:38:08 +02:00
README.md Generate null-safe migration tests if possible 2021-05-11 20:47:23 +02:00
analysis_options.yaml Adapt excludes in analysis options 2021-05-15 10:42:15 +02:00
build.yaml Add tools to generate old versions of a database 2020-10-14 21:15:17 +02:00
pubspec.yaml Generate null-safe migration tests if possible 2021-05-11 20:47:23 +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 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 run moor_generator schema generate moor_migrations/ test/generated/