From 3ab33227b7d4dcae2101938f2798733ff81e073f Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 27 Feb 2023 20:36:01 -0800 Subject: [PATCH] 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. --- docs/pages/docs/Advanced Features/migrations.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/pages/docs/Advanced Features/migrations.md b/docs/pages/docs/Advanced Features/migrations.md index 2dc97ecd..d1f7b933 100644 --- a/docs/pages/docs/Advanced Features/migrations.md +++ b/docs/pages/docs/Advanced Features/migrations.md @@ -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: