2020-10-21 01:33:31 -07:00
|
|
|
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
|
|
|
|
|
|
|
|
```
|
2021-10-09 08:10:34 -07:00
|
|
|
dart run drift_dev schema dump lib/database.dart moor_migrations/moor_schema_v2.json
|
2020-10-21 01:33:31 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
Replace `_v2` with the current `schemaVersion`.
|
|
|
|
|
|
|
|
### Generating test code
|
|
|
|
|
|
|
|
Run
|
|
|
|
|
|
|
|
```
|
2021-12-01 12:06:16 -08:00
|
|
|
dart run drift_dev schema generate drift_migrations/ test/generated/ --data-classes --companions
|
2020-10-21 01:33:31 -07:00
|
|
|
```
|