-
Notifications
You must be signed in to change notification settings - Fork 903
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
Possibility to preserve skipped attributes on reify #579
Possibility to preserve skipped attributes on reify #579
Conversation
I actually have no clue why this fails:
|
Don't worry about the JsonVersion test, it's flakey. I ran it again and it passed. |
Can you squash this into one commit, please? |
t.string "name" | ||
end | ||
|
||
create_table "translations", force: true do |t| | ||
create_table "translations", force: :cascade do |t| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did the force
option change from true
to :cascade
on every table? Is that the new recommended value, or is it something you did intentionally? From the docs:
:force
Set to true to drop the table before creating it. Set to :cascade to drop
dependent objects as well. Defaults to false.
It seems like with force: true
the order of table creation wouldn't matter, but with :cascade
it would, so true
seems preferable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was changed during db:migrate. This has changed since Rails 4.2. The release notes say:
SchemaDumper uses force: :cascade on create_table. This makes it possible to reload a schema when foreign keys are in place.
This seems like a useful feature, and it doesn't increase the complexity of Also, I like this as an option to As far as the API is concerned, you have: + # :preserve `false` default behaviour
+ # `true` preserve attributes of reified object instead of setting
+ # unknown attributes to nil but I think I'd prefer something like: + # :unversioned_attribute `:nil` - (default) attributes undefined in version record
+ # are set to nil in reified record
+ # `:preserve` - attributes undefined in version record are
+ # not modified My thinking is, this allows for a third option in the future. |
52b8e00
to
4db87df
Compare
Hello Jared, |
Possibility to preserve skipped attributes on reify
Merged. Thanks Moritz! |
Hello, i added the possibility to preserve skipped attributes on reify instead of setting them all to nil.
I added an option to the reify method to enable this behaviour. A Test is attached to this PR.
Thanks for merging.