drift/examples/migrations_example
Simon Binder 116f98269d
Always enable the new SQL generation mode
2022-07-03 21:53:17 +02:00
..
drift_migrations Support drift-defined views schema tools (#1813) 2022-04-23 23:31:04 +02:00
lib Change integration tests' dialect to postgres 2022-06-30 19:04:55 +02:00
test Support drift-defined views schema tools (#1813) 2022-04-23 23:31:04 +02:00
README.md Write Dart refences into schema files 2022-04-04 22:32:07 +02:00
analysis_options.yaml Move examples into top-level folder 2022-04-01 22:11:21 +02:00
build.yaml Always enable the new SQL generation mode 2022-07-03 21:53:17 +02:00
pubspec.yaml Move examples into top-level folder 2022-04-01 22:11:21 +02:00

README.md

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

dart run drift_dev schema dump lib/database.dart drift_migrations/

Generating test code

Run

dart run drift_dev schema generate drift_migrations/ test/generated/ --data-classes --companions

We're also using test code inside lib/ to run migrations with older definitions of tables. This isn't required for all migrations, but can be useful in some cases.

dart run drift_dev schema generate drift_migrations/ lib/src/generated