-
-
Notifications
You must be signed in to change notification settings - Fork 727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nuking db during development #381
Merged
Merged
Conversation
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
@bellebethcooper, what do you think of the description of the feature? |
…test database erasure with internal SQLite objects
@groue This looks great! So easy to use, also. Thanks for the quick turnaround! I think this will be super useful in future :) |
Sounds great 👍 Thank you, and Realm, for the inspiration! |
Shipped in v3.2.0! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a pull request that addresses #378 by @bellebethcooper.
A DatabaseMigrator can automatically wipe out the full database content, and recreate the whole database from scratch, if it detects that a migration has changed its definition:
Beware! This flag can destroy your precious users' data!
Yet it may be useful in those two situations:
During application development, as you are still designing migrations, and the schema changes often.
In this case, it is recommended that this flag does not ship in the distributed application:
When the database content can easily be recreated, such as a cache for some downloaded data.
The
eraseDatabaseOnSchemaChange
option triggers a recreation of the database if the migrator detects a schema change. A schema change is any difference in thesqlite_master
table, which contains the SQL used to create database tables, indexes, triggers, and views.This pull request also adds the two following methods:
DatabaseWriter.erase()
DatabaseWriter.vacuum()
Those are not documented in the main README, and only exposed in the reference documentation.