Git Product home page Git Product logo

Comments (3)

Envek avatar Envek commented on June 27, 2024 1

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.

Envek avatar Envek commented on June 27, 2024

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.

masterzeus05 avatar masterzeus05 commented on June 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.