Skip to content

Commit 77e4ad2

Browse files
committed
5166: Remove item category
1 parent 7030ad3 commit 77e4ad2

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
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

0 commit comments

Comments
 (0)