-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADP-3214] Put responsibility for migrations into `withLoadDBLayerFro…
…mFile` (#4230) In order to improve the database initialization logic, this pull request refactors the `withLoadDBLayerFromFile` function to take full responsibility for running migrations on the database file. - [x] A function `migrateDBFile` does what its name suggests. - [x] `withLoadDBLayerFromFile ` calls `withSqliteContextFile` with empty migrations - [x] The new-style migrations are removed from `withSqliteContextFile` As the auto-migrations are no longer run when loading a database, we also need to adjust the `Migrations.Old` to explicitly create tables and columns in order to migrate a pre-version database to `SchemaVersion 1`. As a result of these changes, we can make the migration from `SchemaVersion 2` to `SchemaVersion 3` more strict — it will now fail if a table that should be present in `SchemaVersion 2` cannot be found. ### Comments * In a future pull request, `withBootDBLayerFromFile` and `newBootDBLayerInMemory` need to be adjusted as well, so that they call `withSqliteContextFile` with empty migrations. ### Issue ADP-3214
- Loading branch information
Showing
8 changed files
with
668 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.