Browse Source

Add elements to load model

master
jimi 16 years ago
committed by jimi
parent
commit
15db910a4f
  1. 17
      db/migrate/20090311211804_add_locations_to_load.rb
  2. 11
      db/migrate/20090311214253_add_stored_values_to_load.rb
  3. 19
      db/migrate/20090311215350_add_common_costs_to_load.rb
  4. 15
      db/schema.rb

17
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

11
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

19
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

15
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|