File tree Expand file tree Collapse file tree 1 file changed +4
-26
lines changed Expand file tree Collapse file tree 1 file changed +4
-26
lines changed Original file line number Diff line number Diff line change @@ -39,31 +39,9 @@ After changing the structure of your database schema, for instance by adding
3939new tables or altering columns, you need to write a migration to ensure that
4040existing users of your app can convert their database to the latest version.
4141
42- Drift contains [ builtin APIs] ( https://drift.simonbinder.eu/docs/advanced-features/migrations/ )
43- for common migrations.
44- Also, it includes builtin tools to verify that migrations are doing what they're
45- supposed to do.
42+ Run the following command to save the new schema and generate a step-by-step migration helper for
43+ this schema.
4644
47- To write such tests, run the following command after making schema changes and
48- incrementing your schema version. It will export the current schema of the
49- database as a JSON file. You should check those generated files into source control.
50-
51- ```
52- dart run drift_dev schema dump lib/database/database.dart drift_schemas/
53- ```
54-
55- Then, run the following command to automatically generate test utilities which
56- you can use to write unit tests for schema migrations:
57-
58- ```
59- dart run drift_dev schema generate drift_schemas/ test/generated_migrations/
6045```
61-
62- To make migrations easier, this command updates the ` lib/database/schema_versions.dart `
63- file containing snapshots of older database schema:
64-
65- ```
66- dart run drift_dev schema steps drift_schemas/ lib/database/schema_versions.dart
67- ```
68-
69- An example for a schema test is in ` test/migration_test.dart ` .
46+ dart run drift_dev make-migration
47+ ```
You can’t perform that action at this time.
0 commit comments