-
Notifications
You must be signed in to change notification settings - Fork 69
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
Initial MyTurn import and field rearrangement #1822
Conversation
module ItemAttributes | ||
module ItemCategorization |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The story here is that the category code is reusable in both Item
and ItemPool
, but power_source
is only on Item
and ReservableItem
, so I made this file only include the category parts.
class AdjustItemPoolFields < ActiveRecord::Migration[7.2] | ||
def change | ||
remove_column :item_pools, :brand, :string | ||
remove_column :item_pools, :model, :string | ||
remove_column :item_pools, :size, :string | ||
remove_column :item_pools, :strength, :string | ||
remove_column :item_pools, :power_source, :enum, enum_type: "power_source" | ||
remove_column :item_pools, :location_area, :string | ||
remove_column :item_pools, :location_shelf, :string | ||
remove_column :item_pools, :purchase_link, :string | ||
remove_column :item_pools, :url, :string | ||
add_column :reservable_items, :size, :string | ||
add_column :reservable_items, :strength, :string | ||
add_column :reservable_items, :power_source, :enum, enum_type: "power_source" | ||
add_column :reservable_items, :location_area, :string | ||
add_column :reservable_items, :location_shelf, :string | ||
add_column :reservable_items, :purchase_link, :string | ||
add_column :reservable_items, :url, :string | ||
remove_column :reservable_items, :name, :string | ||
add_column :item_pools, :checkout_notice, :string | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration kind of tells the whole story of what's changing, in terms of which fields are moving to where.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. 👍 I had a couple of little notes that are really more like "maybe this would help a little?"
What it does
ItemPool
toReservableItem
as discussed at a recent meetup.ReservableItem
s in anItemPool
so we can see that the import works 😄This change was a bit bigger than I was hoping for, so the diff is a bit chaotic.