drift/extras/migrations_example
Simon Binder ca2be1bb6a
Add Dart default value to generated schema (#1018)
2021-01-27 22:10:34 +01:00
..
lib Add Dart default value to generated schema (#1018) 2021-01-27 22:10:34 +01:00
moor_migrations Add Dart default value to generated schema (#1018) 2021-01-27 22:10:34 +01:00
test Add Dart default value to generated schema (#1018) 2021-01-27 22:10:34 +01:00
README.md Add Dart default value to generated schema (#1018) 2021-01-27 22:10:34 +01: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 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/