Skip to content

Commit 0358129

Browse files
authored
Merge pull request #5205 from rubyforgood/5166-remove-item-category
5166: Remove item category
2 parents f005fbc + aeaff49 commit 0358129

File tree

8 files changed

+22
-11
lines changed

8 files changed

+22
-11
lines changed

app/models/item.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# active :boolean default(TRUE)
77
# additional_info :text
88
# barcode_count :integer
9-
# category :string
109
# distribution_quantity :integer
1110
# name :string
1211
# on_hand_minimum_quantity :integer default(0), not null

db/migrate/20250504183911_remove_short_name_from_organizations.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
class RemoveShortNameFromOrganizations < ActiveRecord::Migration[8.0]
22
def up
33
safety_assured do
4-
remove_index :organizations, :short_name
5-
remove_column :organizations, :short_name
4+
if index_exists?(:organizations, :short_name)
5+
remove_index :organizations, :short_name
6+
end
7+
if column_exists?(:organizations, :short_name)
8+
remove_column :organizations, :short_name
9+
end
610
end
711
end
812

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class RemoveItemCategory < ActiveRecord::Migration[8.0]
2+
def up
3+
safety_assured do
4+
remove_column :items, :category
5+
end
6+
end
7+
8+
def down
9+
add_column :items, :category, :string
10+
end
11+
end

db/schema.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[8.0].define(version: 2025_05_04_183911) do
13+
ActiveRecord::Schema[8.0].define(version: 2025_05_23_203808) do
1414
# These are extensions that must be enabled in order to support this database
1515
enable_extension "pg_catalog.plpgsql"
1616

@@ -392,7 +392,6 @@
392392

393393
create_table "items", id: :serial, force: :cascade do |t|
394394
t.string "name"
395-
t.string "category"
396395
t.datetime "created_at", precision: nil, null: false
397396
t.datetime "updated_at", precision: nil, null: false
398397
t.integer "barcode_count"

spec/factories/items.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# active :boolean default(TRUE)
77
# additional_info :text
88
# barcode_count :integer
9-
# category :string
109
# distribution_quantity :integer
1110
# name :string
1211
# on_hand_minimum_quantity :integer default(0), not null

spec/models/item_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# active :boolean default(TRUE)
77
# additional_info :text
88
# barcode_count :integer
9-
# category :string
109
# distribution_quantity :integer
1110
# name :string
1211
# on_hand_minimum_quantity :integer default(0), not null

spec/requests/items_requests_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
it { is_expected.to be_successful }
2020

2121
it "highlights total quantity if it is below minimum quantity" do
22-
item_pullups = create(:item, name: "the most wonderful magical pullups that truly potty train", category: "Magic Toddlers", on_hand_minimum_quantity: 100)
23-
item_tampons = create(:item, name: "blackbeard's rugged tampons", category: "Menstrual Products", on_hand_minimum_quantity: 100)
22+
item_pullups = create(:item, name: "the most wonderful magical pullups that truly potty train", on_hand_minimum_quantity: 100)
23+
item_tampons = create(:item, name: "blackbeard's rugged tampons", on_hand_minimum_quantity: 100)
2424
storage_name = "the poop catcher warehouse"
2525
num_pullups_in_donation = 666
2626
num_pullups_second_donation = 15

spec/system/item_system_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@
112112
end
113113

114114
describe "Item Table Tabs >" do
115-
let(:item_pullups) { create(:item, name: "the most wonderful magical pullups that truly potty train", category: "Magic Toddlers") }
116-
let(:item_tampons) { create(:item, name: "blackbeard's rugged tampons", category: "Menstrual Products") }
115+
let(:item_pullups) { create(:item, name: "the most wonderful magical pullups that truly potty train") }
116+
let(:item_tampons) { create(:item, name: "blackbeard's rugged tampons") }
117117
let(:storage_name) { "the poop catcher warehouse" }
118118
let(:storage) { create(:storage_location, :with_items, item: item_pullups, item_quantity: num_pullups_in_donation, name: storage_name) }
119119
let!(:aux_storage) { create(:storage_location, :with_items, item: item_pullups, item_quantity: num_pullups_second_donation, name: "a secret secondary location") }

0 commit comments

Comments
 (0)