-
Notifications
You must be signed in to change notification settings - Fork 19
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
Foreign key nullification #11
Comments
I believe that reason for this is avoiding errors with foreign key constraints in the database. So it actually may be a feature (but not sure). Please provide your EvilSeed configuration. Possible workarounds: instruct evil-seed to dump Person, Cars, and PersonCarBorrows separately. |
The configuration is something like EvilSeed.configure do |config|
config.root("Person", id: ids) do |root|
root.exclude(/\.translations/)
end
config.root("Car") do |root|
root.exclude(/\.translations/)
root.exclude(/car\.person_car_borrows\.person\..*/)
end
end So the problem might actually be related to this exclude EDIT: Just to add that Person has defined in it has_many :person_car_borrows, dependent: :restrict_with_exception EDIT2: Ok I think that the problem is just related with the order of the configuration? It just worked now by changing the order, so thanks! |
Got it. This is feature to keep referential integrity. If you don't interested in persons that a Car is borrowed to, then you won't have them in the database. In that case, if you try to insert record to |
Hey! Sorry to bother again, but this time I found an issue that I don't know if it is really a bug or just something about my schema or configuration.
For example, I have 3 models,
Person
,Car
,PersonCarBorrow
, and thePersonCarBorrow
has defined:And when dumping this schema, with root on
Person
, the PersonCarBorrow will have thePerson
foreign keyperson_id
NULL, and theCar
foreign key with the correct value.My gems versions:
After a little search, I think the issue is related with this line relation_dumper#149, as the foreign_key is nullified because of the condition on
excluded = ... || reflection.name == inverse_reflection
.A fork of this gem already made a change related to this shippio/evil-seed-41025192b46649cf43af91d7fd7a80358a9e7379.
Thank you for your help.
The text was updated successfully, but these errors were encountered: