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

Add foreign key for script to section #35032

Merged
merged 1 commit into from May 29, 2020
Merged

Conversation

dmcavoy
Copy link
Contributor

@dmcavoy dmcavoy commented May 29, 2020

A while back I ran into a problem where I locally deleted a script that a section was assigned to. To prevent this from being an issue for anyone in the future this adds a foreign key for script in section.

Copy link

@uponthesun uponthesun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting that we were in this state in the first place, I'd thought belongs_to was supposed to mean there was a foreign key. Seems like an improvement to me.

@davidsbailey
Copy link
Member

Interesting that we were in this state in the first place, I'd thought belongs_to was supposed to mean there was a foreign key. Seems like an improvement to me.

Good point @uponthesun . I had to look this up: https://guides.rubyonrails.org/v5.2/association_basics.html#updating-the-schema

Associations are extremely useful, but they are not magic. You are responsible for maintaining your database schema to match your associations... For belongs_to associations you need to create foreign keys...

@dmcavoy dmcavoy merged commit 8e66dc6 into staging May 29, 2020
@dmcavoy dmcavoy deleted the foreign-key-script-section branch May 29, 2020 13:14
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

Successfully merging this pull request may close these issues.

None yet

3 participants