Skip to content

Kits part 2 - KitItem#5517

Open
dorner wants to merge 4 commits intomainfrom
kits-part2-kititem
Open

Kits part 2 - KitItem#5517
dorner wants to merge 4 commits intomainfrom
kits-part2-kititem

Conversation

@dorner
Copy link
Collaborator

@dorner dorner commented Mar 13, 2026

This PR is the next step on the Kit roadmap #3652.

This creates two new classes, KitItem and ConcreteItem, and turns Item into a parent class by adding a type column and Single Table Inheritance. It renames the association between kits and items to kit_item to make this more explicit.

The next PR will have us actually switch from creating / updating kits to creating / updating KitItems, and move the sync from kit -> item to instead be kit_item -> kit (for backwards compatibility - we'll stop looking at kits entirely unless something goes wrong). We'll update code that reads from kits to instead read from kit items and stop following that link.

Finally we'll stop the backwards writing and kill off kits for good.

Most of this PR is just the rename of item to kit_item :)

@dorner dorner requested a review from awwaiid March 13, 2026 20:43
Comment on lines +3 to +4
add_column :items, :type, :string, default: 'ConcreteItem', null: false
Item.where.not(kit_id: nil).update_all(type: 'KitItem', updated_at: Time.zone.now)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice

t.index ["user_id"], name: "index_deprecated_feedback_messages_on_user_id"
end

create_table "diaper_drive_participants", id: :serial, force: :cascade do |t|
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unrelated table drop -- is it incorrectly in the main branch, or is this a mistake in the PR?

Copy link
Collaborator

@awwaiid awwaiid left a comment

Choose a reason for hiding this comment

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

CI failures look like they are at least from some SQL reports. Also some stray things got into the schema.rb

Concept continues to be good and good incremental step. One validation to add (in the next PR probably) is that a ConcreteItem should not be allowed to have any line_items, I think?

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.

2 participants