From 15db910a4f3558d238e478cbb072da55ce7b4e50 Mon Sep 17 00:00:00 2001 From: jimi Date: Wed, 11 Mar 2009 17:17:59 -0500 Subject: [PATCH] Add elements to load model --- .../20090311211804_add_locations_to_load.rb | 17 +++++++++++++++++ ...0090311214253_add_stored_values_to_load.rb | 11 +++++++++++ ...20090311215350_add_common_costs_to_load.rb | 19 +++++++++++++++++++ db/schema.rb | 15 ++++++++++++++- 4 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20090311211804_add_locations_to_load.rb create mode 100644 db/migrate/20090311214253_add_stored_values_to_load.rb create mode 100644 db/migrate/20090311215350_add_common_costs_to_load.rb diff --git a/db/migrate/20090311211804_add_locations_to_load.rb b/db/migrate/20090311211804_add_locations_to_load.rb new file mode 100644 index 0000000..5da8c98 --- /dev/null +++ b/db/migrate/20090311211804_add_locations_to_load.rb @@ -0,0 +1,17 @@ +class AddLocationsToLoad < ActiveRecord::Migration + def self.up + add_column :loads, :shipper, :string + add_column :loads, :destination, :string + add_column :loads, :origin, :string + add_column :loads, :start_point, :string + add_column :loads, :lookup, :integer + end + + def self.down + remove_column :loads, :lookup + remove_column :loads, :start_point + remove_column :loads, :origin + remove_column :loads, :destination + remove_column :loads, :shipper + end +end diff --git a/db/migrate/20090311214253_add_stored_values_to_load.rb b/db/migrate/20090311214253_add_stored_values_to_load.rb new file mode 100644 index 0000000..cf17290 --- /dev/null +++ b/db/migrate/20090311214253_add_stored_values_to_load.rb @@ -0,0 +1,11 @@ +class AddStoredValuesToLoad < ActiveRecord::Migration + def self.up + add_column :loads, :truck, :string + add_column :loads, :trailer, :string + end + + def self.down + remove_column :loads, :trailer + remove_column :loads, :truck + end +end diff --git a/db/migrate/20090311215350_add_common_costs_to_load.rb b/db/migrate/20090311215350_add_common_costs_to_load.rb new file mode 100644 index 0000000..8405d2a --- /dev/null +++ b/db/migrate/20090311215350_add_common_costs_to_load.rb @@ -0,0 +1,19 @@ +class AddCommonCostsToLoad < ActiveRecord::Migration + def self.up + add_column :loads, :fuel_gallons, :decimal, :precision => 8, :scale => 3, :default => 0 + add_column :loads, :fuel_cost, :decimal, :precision => 8, :scale => 2, :default => 0 + add_column :loads, :scales, :decimal, :precision => 6, :scale => 2, :default => 0 + add_column :loads, :loading, :decimal, :precision => 6, :scale => 2, :default => 0 + add_column :loads, :unloading, :decimal, :precision => 6, :scale => 2, :default => 0 + add_column :loads, :stops, :integer, :default => 0 + end + + def self.down + remove_column :loads, :stops + remove_column :loads, :unloading + remove_column :loads, :loading + remove_column :loads, :scales + remove_column :loads, :fuel_cost + remove_column :loads, :fuel_gallons + end +end diff --git a/db/schema.rb b/db/schema.rb index 11b4232..0ed52b0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20090311181736) do +ActiveRecord::Schema.define(:version => 20090311215350) do create_table "loads", :force => true do |t| t.string "number" @@ -19,6 +19,19 @@ ActiveRecord::Schema.define(:version => 20090311181736) do t.integer "hub_out" t.datetime "created_at" t.datetime "updated_at" + t.string "shipper" + t.string "destination" + t.string "origin" + t.string "start_point" + t.integer "lookup" + t.string "truck" + t.string "trailer" + t.decimal "fuel_gallons", :precision => 8, :scale => 3, :default => 0.0 + t.decimal "fuel_cost", :precision => 8, :scale => 2, :default => 0.0 + t.decimal "scales", :precision => 6, :scale => 2, :default => 0.0 + t.decimal "loading", :precision => 6, :scale => 2, :default => 0.0 + t.decimal "unloading", :precision => 6, :scale => 2, :default => 0.0 + t.integer "stops", :default => 0 end create_table "people", :force => true do |t|