Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/models/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
class RemoveShortNameFromOrganizations < ActiveRecord::Migration[8.0]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Didn't we already remove the short name in #5187?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This isn't a new migration, it's just adding a check inside it so it wouldn't crash if it already ran.

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

Expand Down
11 changes: 11 additions & 0 deletions db/migrate/20250523203808_remove_item_category.rb
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion spec/factories/items.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion spec/models/item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/requests/items_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/system/item_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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") }
Expand Down