Conversation
| add_column :items, :type, :string, default: 'ConcreteItem', null: false | ||
| Item.where.not(kit_id: nil).update_all(type: 'KitItem', updated_at: Time.zone.now) |
| t.index ["user_id"], name: "index_deprecated_feedback_messages_on_user_id" | ||
| end | ||
|
|
||
| create_table "diaper_drive_participants", id: :serial, force: :cascade do |t| |
There was a problem hiding this comment.
Unrelated table drop -- is it incorrectly in the main branch, or is this a mistake in the PR?
There was a problem hiding this comment.
It's incorrectly in the main branch.
awwaiid
left a comment
There was a problem hiding this comment.
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?
| let(:outside_time) { Time.zone.parse("2019-05-31 14:00:00") } | ||
|
|
||
| # Concrete items that go inside kits | ||
| let!(:ai_concrete_1) { create(:item, name: "Adult Briefs (Medium)", reporting_category: "adult_incontinence", organization: organization) } |
There was a problem hiding this comment.
This one had to be rearchitected a bit because it was set up incorrectly - it just "happened" to work because the kit -> item relationship was identical to the line item -> item relationship. So this put the kit item inside the kit instead of something like diapers inside the kit 😂
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
typecolumn and Single Table Inheritance. It renames the association between kits and items tokit_itemto 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
itemtokit_item:)