mirror of https://github.com/AMT-Cheif/drift.git
Make explicit `schema generate` command for migration data tests
These flags are mentioned in the prose of this section, but it's easy to miss them (or at least, I missed them) there and rely on the `schema generate` command given in the previous section. That one generates the expected files, but with this section's code it leads to an error: Unsupported operation: TableInfo.map in schema verification code because the generated code has a stub implementation of `map`. Make it easier to spot the need for these flags by providing an explicit complete command using them.
This commit is contained in:
parent
b137b4065e
commit
3ab33227b7
|
@ -396,7 +396,11 @@ This can be used to insert data before a migration. After the migration ran, you
|
|||
Note that you can't use the regular database class from you app for this, since its data classes always expect the latest
|
||||
schema. However, you can instruct drift to generate older snapshots of your data classes and companions for this purpose.
|
||||
To enable this feature, pass the `--data-classes` and `--companions` command-line arguments to the `drift_dev schema generate`
|
||||
command.
|
||||
command:
|
||||
|
||||
```
|
||||
$ dart run drift_dev schema generate --data-classes --companions drift_schemas/ test/generated_migrations/
|
||||
```
|
||||
|
||||
Then, you can import the generated classes with an alias:
|
||||
|
||||
|
|
Loading…
Reference in New Issue