Skip to content

Conversation

@dalmaboros
Copy link
Collaborator

@dalmaboros dalmaboros commented Sep 14, 2025

What is the goal of this PR and why is this important?

We created the Organization model, and Organizations have and belong to many Workshops. This PR implements that association.

How did you approach the change?

Just made a join table.

Anything else to add?

⚠️ Note: In order for this change to work, the ids on Organization and Facilitator had to be changed from bigint to integer.

@dalmaboros dalmaboros marked this pull request as ready for review September 14, 2025 14:23
@cflipse
Copy link
Collaborator

cflipse commented Sep 15, 2025

Question: Why is this changing the id column type from bigint to integer ?

If we're going to juggle ID column types ... that probably should happen in it's own PR, with a justification that's going to be findable looking through history on it's own (since everything is a squash, standalone ideas get buried in much larger changesets, which makes history spelunking harder)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was this controller deleted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's an empty controller not serving any purpose, so I actually never meant to include it in the initial PR, and thought we could add it back in if we need it in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't want the organizations controller anymore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't mean to include an empty controller in the last PR, so my thinking was that I'd remove it until we actually need it.

@dalmaboros
Copy link
Collaborator Author

dalmaboros commented Sep 25, 2025

Question: Why is this changing the id column type from bigint to integer ?

If we're going to juggle ID column types ... that probably should happen in it's own PR, with a justification that's going to be findable looking through history on it's own (since everything is a squash, standalone ideas get buried in much larger changesets, which makes history spelunking harder)

@cflipse We can't have foreign key constraints with mixed types, so in order for the OrganizationWorkshops join table to use foreign key constraints, I had to change one of the id types, and it was just simpler to change Organization id to integer than Workshop id to bigint (since Workshop has a bunch of other associations that would then have to change too).

But actually... ideally I suspect we'd rather want all the resources to have id types of bigint, since that's the modern Rails 8 way (and why Organization was generated with id type of bigint in the first place). That would take more work, as Workshop has more existing associations. So, yeah, we could def do a separate PR where we update some (or all?) id types to bigint.

What do you think? Thanks for calling this out, btw.

@dalmaboros dalmaboros requested a review from maebeale September 25, 2025 09:26
@dalmaboros
Copy link
Collaborator Author

@maebeale Oops, didn't mean to request another review since I didn't change anything. I did respond to comments tho.

Copy link
Collaborator

@maebeale maebeale left a comment

Choose a reason for hiding this comment

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

Looks great, @dalmaboros ! Please rebase main and merge whenever you're ready.

@cflipse
Copy link
Collaborator

cflipse commented Sep 30, 2025

Question: Why is this changing the id column type from bigint to integer ?
If we're going to juggle ID column types ... that probably should happen in it's own PR, with a justification that's going to be findable looking through history on it's own (since everything is a squash, standalone ideas get buried in much larger changesets, which makes history spelunking harder)

@cflipse We can't have foreign key constraints with mixed types, so in order for the OrganizationWorkshops join table to use foreign key constraints, I had to change one of the id types, and it was just simpler to change Organization id to integer than Workshop id to bigint (since Workshop has a bunch of other associations that would then have to change too).

But actually... ideally I suspect we'd rather want all the resources to have id types of bigint, since that's the modern Rails 8 way (and why Organization was generated with id type of bigint in the first place). That would take more work, as Workshop has more existing associations. So, yeah, we could def do a separate PR where we update some (or all?) id types to bigint.

What do you think? Thanks for calling this out, btw.

Okay, yeah -- that makes sense, as for the reasoning for the change. Ah, foreign keys.

Rails has been using bigint by default since ... 5.x it seems. Which certainly suggests the tables that still have integer ids are going to be the older, more foundational tables.

I'd say that it's very likely that we want to have a single PR dedicated to migrating all ID columns to bigint, one big sweep.

🤔 If you skip adding the FK constraint, that should avoid your need to change the existing tables, to unblock here. Then we can do a follow-up to tighten up the in-db constraints after keys are consistent. How does that sound?

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.

3 participants