diff --git a/app/models/item.rb b/app/models/item.rb index 5b00957395..2c861539e7 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -6,7 +6,6 @@ # active :boolean default(TRUE) # additional_info :text # barcode_count :integer -# category :string # distribution_quantity :integer # name :string # on_hand_minimum_quantity :integer default(0), not null diff --git a/db/migrate/20250504183911_remove_short_name_from_organizations.rb b/db/migrate/20250504183911_remove_short_name_from_organizations.rb index 9f318c86c1..3e6eef37ec 100644 --- a/db/migrate/20250504183911_remove_short_name_from_organizations.rb +++ b/db/migrate/20250504183911_remove_short_name_from_organizations.rb @@ -1,8 +1,12 @@ class RemoveShortNameFromOrganizations < ActiveRecord::Migration[8.0] def up safety_assured do - remove_index :organizations, :short_name - remove_column :organizations, :short_name + if index_exists?(:organizations, :short_name) + remove_index :organizations, :short_name + end + if column_exists?(:organizations, :short_name) + remove_column :organizations, :short_name + end end end diff --git a/db/migrate/20250523203808_remove_item_category.rb b/db/migrate/20250523203808_remove_item_category.rb new file mode 100644 index 0000000000..91d8d08acb --- /dev/null +++ b/db/migrate/20250523203808_remove_item_category.rb @@ -0,0 +1,11 @@ +class RemoveItemCategory < ActiveRecord::Migration[8.0] + def up + safety_assured do + remove_column :items, :category + end + end + + def down + add_column :items, :category, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 25c73f88a0..a705db4f8c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[8.0].define(version: 2025_05_04_183911) do +ActiveRecord::Schema[8.0].define(version: 2025_05_23_203808) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -392,7 +392,6 @@ create_table "items", id: :serial, force: :cascade do |t| t.string "name" - t.string "category" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false t.integer "barcode_count" diff --git a/spec/factories/items.rb b/spec/factories/items.rb index b818932dc1..c482c11215 100644 --- a/spec/factories/items.rb +++ b/spec/factories/items.rb @@ -6,7 +6,6 @@ # active :boolean default(TRUE) # additional_info :text # barcode_count :integer -# category :string # distribution_quantity :integer # name :string # on_hand_minimum_quantity :integer default(0), not null diff --git a/spec/models/item_spec.rb b/spec/models/item_spec.rb index 3b30640114..e7120c32cd 100644 --- a/spec/models/item_spec.rb +++ b/spec/models/item_spec.rb @@ -6,7 +6,6 @@ # active :boolean default(TRUE) # additional_info :text # barcode_count :integer -# category :string # distribution_quantity :integer # name :string # on_hand_minimum_quantity :integer default(0), not null diff --git a/spec/requests/items_requests_spec.rb b/spec/requests/items_requests_spec.rb index 832ebcb836..a3cc49ae14 100644 --- a/spec/requests/items_requests_spec.rb +++ b/spec/requests/items_requests_spec.rb @@ -19,8 +19,8 @@ it { is_expected.to be_successful } it "highlights total quantity if it is below minimum quantity" do - item_pullups = create(:item, name: "the most wonderful magical pullups that truly potty train", category: "Magic Toddlers", on_hand_minimum_quantity: 100) - item_tampons = create(:item, name: "blackbeard's rugged tampons", category: "Menstrual Products", on_hand_minimum_quantity: 100) + item_pullups = create(:item, name: "the most wonderful magical pullups that truly potty train", on_hand_minimum_quantity: 100) + item_tampons = create(:item, name: "blackbeard's rugged tampons", on_hand_minimum_quantity: 100) storage_name = "the poop catcher warehouse" num_pullups_in_donation = 666 num_pullups_second_donation = 15 diff --git a/spec/system/item_system_spec.rb b/spec/system/item_system_spec.rb index 0bb156b191..552b68a110 100644 --- a/spec/system/item_system_spec.rb +++ b/spec/system/item_system_spec.rb @@ -112,8 +112,8 @@ end describe "Item Table Tabs >" do - let(:item_pullups) { create(:item, name: "the most wonderful magical pullups that truly potty train", category: "Magic Toddlers") } - let(:item_tampons) { create(:item, name: "blackbeard's rugged tampons", category: "Menstrual Products") } + let(:item_pullups) { create(:item, name: "the most wonderful magical pullups that truly potty train") } + let(:item_tampons) { create(:item, name: "blackbeard's rugged tampons") } let(:storage_name) { "the poop catcher warehouse" } let(:storage) { create(:storage_location, :with_items, item: item_pullups, item_quantity: num_pullups_in_donation, name: storage_name) } let!(:aux_storage) { create(:storage_location, :with_items, item: item_pullups, item_quantity: num_pullups_second_donation, name: "a secret secondary location") }