From 7069f6134f686c68d626faf2d10ded50c1a0cb7a Mon Sep 17 00:00:00 2001 From: Walter Alves Date: Tue, 25 Apr 2017 16:20:24 -0300 Subject: [PATCH 1/4] Create a migration to asset details table Add a migration to create asset_details table. --- .../20170425185231_create_asset_details.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 db/migrate/20170425185231_create_asset_details.rb diff --git a/db/migrate/20170425185231_create_asset_details.rb b/db/migrate/20170425185231_create_asset_details.rb new file mode 100644 index 00000000000..3a29be23369 --- /dev/null +++ b/db/migrate/20170425185231_create_asset_details.rb @@ -0,0 +1,16 @@ +class CreateAssetDetails < ActiveRecord::Migration[5.0] + def change + create_table :asset_details do |t| + t.text :description + t.text :contact + t.text :location + t.text :room + t.text :rack_name + t.text :lowest_rack_unit + t.bigint :resource_id + t.string :resource_type + t.timestamps + t.index %w(resource_id resource_type), :name => "index_asset_details_on_resource_id_and_resource_type", :using => :btree + end + end +end From 648a3578938625bab3400fefd689306a11dc1c2e Mon Sep 17 00:00:00 2001 From: Walter Alves Date: Tue, 25 Apr 2017 16:20:59 -0300 Subject: [PATCH 2/4] Update db/schema.yml Add properties to schema.yml referring to the new table(asset_details). --- db/schema.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/db/schema.yml b/db/schema.yml index becc8b75e7d..f2aa105e01c 100644 --- a/db/schema.yml +++ b/db/schema.yml @@ -66,6 +66,18 @@ arbitration_settings: - value - created_on - updated_on +asset_details: +- id +- description +- contact +- location +- room +- rack_name +- lowest_rack_unit +- resource_id +- resource_type +- created_at +- updated_at assigned_server_roles: - id - miq_server_id From 0a47b32b81f6c3f06ebe757d4a1602c8b23fd0f8 Mon Sep 17 00:00:00 2001 From: Walter Alves Date: Tue, 25 Apr 2017 17:15:45 -0300 Subject: [PATCH 3/4] Fix Rubocop warnings --- db/migrate/20170425185231_create_asset_details.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20170425185231_create_asset_details.rb b/db/migrate/20170425185231_create_asset_details.rb index 3a29be23369..21934f053b0 100644 --- a/db/migrate/20170425185231_create_asset_details.rb +++ b/db/migrate/20170425185231_create_asset_details.rb @@ -2,7 +2,7 @@ class CreateAssetDetails < ActiveRecord::Migration[5.0] def change create_table :asset_details do |t| t.text :description - t.text :contact + t.text :contact t.text :location t.text :room t.text :rack_name From 33eecf1231055ea139a6148703969d04f2c7131a Mon Sep 17 00:00:00 2001 From: Walter Alves Date: Wed, 3 May 2017 09:54:24 -0300 Subject: [PATCH 4/4] Remove 'name' and 'using' from index Remove 'name' and 'using' from asset details index. --- db/migrate/20170425185231_create_asset_details.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20170425185231_create_asset_details.rb b/db/migrate/20170425185231_create_asset_details.rb index 21934f053b0..ff7f51b77a9 100644 --- a/db/migrate/20170425185231_create_asset_details.rb +++ b/db/migrate/20170425185231_create_asset_details.rb @@ -10,7 +10,7 @@ def change t.bigint :resource_id t.string :resource_type t.timestamps - t.index %w(resource_id resource_type), :name => "index_asset_details_on_resource_id_and_resource_type", :using => :btree + t.index %w(resource_id resource_type) end end end