drift/examples/migrations_example
Alexander Wilde 5a6f402d86 Run build 2022-12-01 04:43:27 +00:00
..
drift_migrations Serialize and read uniqueKeys from schema (#2069) 2022-09-22 17:47:06 +02:00
lib Run build 2022-12-01 04:43:27 +00:00
test Fix generating schema test code 2022-11-28 21:59:17 +01:00
README.md Write Dart refences into schema files 2022-04-04 22:32:07 +02:00
analysis_options.yaml Migrate to `package:lints` 2022-08-13 23:33:05 +02:00
build.yaml Fix migration code for virtual tables (#1988) 2022-08-14 15:01:21 +02:00
pubspec.yaml Use melos to manage packages (#2060) 2022-09-15 23:42:20 +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 drift_dev schema dump lib/database.dart drift_migrations/

Generating test code

Run

dart run drift_dev schema generate drift_migrations/ test/generated/ --data-classes --companions

We're also using test code inside lib/ to run migrations with older definitions of tables. This isn't required for all migrations, but can be useful in some cases.

dart run drift_dev schema generate drift_migrations/ lib/src/generated