From e05cf1dc120019c28b74abed969cdb29527b1f0d Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Wed, 21 May 2008 10:02:23 -0700 Subject: [PATCH] Added precisions to the decimals. Moved virtual fields to be actual db fields. #1135 --- db/migrate/001_create_deliverables.rb | 2 +- db/migrate/003_rename_cost_to_budget.rb | 4 ++-- ...fields_to_deliverables_for_calculations.rb | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 db/migrate/004_add_data_fields_to_deliverables_for_calculations.rb diff --git a/db/migrate/001_create_deliverables.rb b/db/migrate/001_create_deliverables.rb index 8031b73..f25f7ec 100644 --- a/db/migrate/001_create_deliverables.rb +++ b/db/migrate/001_create_deliverables.rb @@ -5,7 +5,7 @@ class CreateDeliverables < ActiveRecord::Migration t.column :due_date, :date t.column :description, :text t.column :type, :string - t.column :cost, :decimal + t.column :cost, :decimal, :precision => 15, :scale => 2 t.column :project_manager_signoff, :boolean, :default => false t.column :client_signoff, :boolean, :default => false end diff --git a/db/migrate/003_rename_cost_to_budget.rb b/db/migrate/003_rename_cost_to_budget.rb index 6278ec7..fc0245c 100644 --- a/db/migrate/003_rename_cost_to_budget.rb +++ b/db/migrate/003_rename_cost_to_budget.rb @@ -1,11 +1,11 @@ class RenameCostToBudget < ActiveRecord::Migration def self.up - add_column :deliverables, :budget, :decimal + add_column :deliverables, :budget, :decimal, :precision => 15, :scale => 2 remove_column :deliverables, :cost end def self.down - add_column :deliverables, :cost, :decimal + add_column :deliverables, :cost, :decimal, :precision => 15, :scale => 2 remove_column :deliverables, :budget end end diff --git a/db/migrate/004_add_data_fields_to_deliverables_for_calculations.rb b/db/migrate/004_add_data_fields_to_deliverables_for_calculations.rb new file mode 100644 index 0000000..ba5e2da --- /dev/null +++ b/db/migrate/004_add_data_fields_to_deliverables_for_calculations.rb @@ -0,0 +1,19 @@ +class AddDataFieldsToDeliverablesForCalculations < ActiveRecord::Migration + def self.up + add_column :deliverables, :overhead, :decimal, :precision => 15, :scale => 2 + add_column :deliverables, :materials, :decimal, :precision => 15, :scale => 2 + add_column :deliverables, :profit, :decimal, :precision => 15, :scale => 2 + add_column :deliverables, :cost_per_hour, :decimal, :precision => 15, :scale => 2 + add_column :deliverables, :total_hours, :decimal, :precision => 15, :scale => 2 + add_column :deliverables, :fixed_cost, :decimal, :precision => 15, :scale => 2 + end + + def self.down + remove_column :deliverables, :overhead + remove_column :deliverables, :materials + remove_column :deliverables, :profit + remove_column :deliverables, :cost_per_hour + remove_column :deliverables, :total_hours + remove_column :deliverables, :fixed_cost + end +end