diff --git a/README.md b/README.md index e52ecbb3e..b132c609c 100644 --- a/README.md +++ b/README.md @@ -181,6 +181,24 @@ Could not determine the dependencies of task ':unifiedpush_android:compileReleas Resolution: Ensure you have a valid Java 8 installation on your machine. +## Database + +Thunder uses the [Drift database](https://drift.simonbinder.eu/) package (a wrapper around SQLite) to store information about the user's accounts, favorites, anonymous subscriptions, and user labels. + +If you happen to work on a contribution which involves updating the database schema, you can follow these steps. + +1. Update schema version in `lib\core\database\database.dart` +2. Add new tables/columns in `lib\core\database\tables.dart` +3. Export schema + - `dart run drift_dev schema dump lib/core/database/database.dart drift_schemas/` +4. Update migrations + - `dart run drift_dev schema steps drift_schemas/ lib/core/database/schema_versions.dart` +5. Go back to `lib\core\database\database.dart` and implement the migration function +6. Update the auto-generated db table models + - `dart run build_runner build` +7. Reformat the auto-generated files + - `dart format --set-exit-if-changed -l 200 lib` + ## Conventions While there are no specific conventions that must be followed, do try to follow best practices whenever possible.