-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fix data migrations #1335
Merged
Merged
Fix data migrations #1335
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
The `select_attributes` method shall provide an easy way to directly select cells from the database. The `update_attributes!` method shall provide an easy way to directly update cells in the database. Except from the `id` method, no model methods are involved.
With `record.update_attributes!`, `save!` is called and may fail because methods are missing or validations fail. We need to call `save!` only if the record has not been persisted yet. Otherwise the column should be changed directly, without invocation of callbacks or validations.
Putting the data migration together with the schema migration, it could even be improved. Now it creates/uses the correct prover.
The link to the ontology already needs to be established in the first migration. Also, the migrations create a ProofAttemptConfiguration, which triggers the before_create callback. They must not assume that the columns have been created.
I don't know who to assign to this pull request. This is connected to both, ontohub in general and the reasoning milestone of my master's thesis. |
To test the migrations, I recommend to
|
Sometimes code is duplicated from models (or lib) into the migrations in order to ensure that they work independently of whether this code is present. Looks a bit odd, but seems to be necessary. 👍 |
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 moves some data-changing migrations from
db/data/
todb/migrate/
becauseThe migrations have been adjusted to directly work on the database and to not depend on model methods. This adds some database queries, but they are only called once so the extra execution time shouldn't hurt.