Skip to content
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

Missing foreign keys according to immigrant #206

Closed
ishigo974 opened this issue Apr 11, 2024 · 2 comments
Closed

Missing foreign keys according to immigrant #206

ishigo974 opened this issue Apr 11, 2024 · 2 comments

Comments

@ishigo974
Copy link

Hi,

I'm using the gem immigrant in my CI in order to find potentially missing foreign_keys.

Since I added solid_queue, here is the error I have:

Missing foreign key relationship on 'solid_queue_claimed_executions.process_id' to 'solid_queue_processes.id'
Missing foreign key relationship on 'solid_queue_processes.supervisor_id' to 'solid_queue_processes.id'

As the gem offers to generate a migration fixing this issue, I just ran it so you can have a look at what it would create. Here it is:

  def change
    add_foreign_key "solid_queue_claimed_executions", "solid_queue_processes", column: "process_id", name: "solid_queue_claimed_executions_process_id_fk"
    add_foreign_key "solid_queue_processes", "solid_queue_processes", column: "supervisor_id", name: "solid_queue_processes_supervisor_id_fk"
  end

I'm not sure about the behaviour of these models, so would it be possible to tell me if I should ignore them or if some foreign keys are really missing here?

Thanks,
Maxime

@rosa
Copy link
Member

rosa commented Apr 11, 2024

Hey @ishigo974, thanks for this! Yes, the gem is right, we could have added these two foreign keys. However, I decided not to add them because their advantages with respect to data integrity weren't that important in this case, and there are some drawbacks to foreign keys in general. In short, yes, you can ignore these 😊

@ishigo974
Copy link
Author

Thanks for your quick answer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants