Comments (3)
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 person_car_borrows
with identifier that is missing from persons
(and you have foreign key in place) then database will throw an error that this value violates referential integrity. So it is better to nullify foreign key value if we know that we're not going to reference anything.
from evil-seed.
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.
from evil-seed.
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 root.exclude(/card\.person_car_borrows\.person\..*/)
?
The only reason I do that exclude is that it is not of my interest to export all "Persons" that a Car is borrowed to, but now that I'm looking at it, maybe the exclude should be root.exclude(/card\..*/)
to avoid the PersonCarBorrows altogether from the Cars?
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!
from evil-seed.
Related Issues (12)
- Ignoring columns or avoiding errors HOT 5
- What would be the best way to anonymize specific attributes in a JSONB column HOT 3
- Ignore generated columns HOT 2
- Model with ActiveStorage attachment can't be anonymized HOT 3
- Errno::EMFILE: Too many open files @ rb_sysopen
- Recursive execution? HOT 3
- Support for Foreign Key attribute on belongs_to HOT 1
- Please provide a full example for non ruby developper HOT 2
- Rails 4.2.x and jruby compatibility HOT 5
- Invalid SQL order by clause from root model configuration HOT 1
- Excluding tables HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from evil-seed.