Added basic rate model and it's database schema

This commit is contained in:
Eric Davis
2009-01-16 13:56:04 -08:00
parent bcc80f13fe
commit a3c12fed19
4 changed files with 31 additions and 0 deletions

2
app/models/rate.rb Normal file
View File

@@ -0,0 +1,2 @@
class Rate < ActiveRecord::Base
end

View File

@@ -0,0 +1,14 @@
class CreateRates < ActiveRecord::Migration
def self.up
create_table :rates do |t|
t.column :amount, :decimal, :precision => 15, :scale => 2
t.column :user_id, :integer
t.column :project_id, :integer
t.column :date_in_effect, :date
end
end
def self.down
drop_table :rates
end
end

View File

@@ -0,0 +1,13 @@
class AddIndexesToRates < ActiveRecord::Migration
def self.up
add_index :rates, :user_id
add_index :rates, :project_id
add_index :rates, :date_in_effect
end
def self.down
remove_index :rates, :user_id
remove_index :rates, :project_id
remove_index :rates, :date_in_effect
end
end

2
spec/models/rate_spec.rb Normal file
View File

@@ -0,0 +1,2 @@
require File.dirname(__FILE__) + '/../spec_helper'