You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
db test: Cover simple migrations without data programmatically
This saves us from writing the simple migration tests between schemas
without data in the future.
---
The tests are inspired by the test template generated from
`dart run drift_dev make-migrations`.
To reproduce the outputs, go through the following steps:
Modify `build.yaml` by specifying the location of the database. This
step is needed because `make-migrations` does not accept this through
command line arguments.
```
targets:
$default:
builders:
# ...
drift_dev:
options:
databases:
default: lib/model/database.dart
```
Then, run the following commands:
```
dart run drift_dev make-migrations
cp test/model/schemas/*.json drift_schemas/default/
dart run drift_dev make-migrations
```
The first `make-migrations` run generates the initial schema and test
files without looking at the versions we have in test/model/schemas.
Copying the schema files and running `make-migrations` will end up
creating `test/drift/default/migration_test.dart`, along with other
generated files.
See also:
https://drift.simonbinder.eu/Migrations/#usage
Signed-off-by: Zixuan James Li <[email protected]>
0 commit comments