Added basic rate model and it's database schema
This commit is contained in:
2
app/models/rate.rb
Normal file
2
app/models/rate.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class Rate < ActiveRecord::Base
|
||||
end
|
||||
14
db/migrate/001_create_rates.rb
Normal file
14
db/migrate/001_create_rates.rb
Normal 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
|
||||
13
db/migrate/002_add_indexes_to_rates.rb
Normal file
13
db/migrate/002_add_indexes_to_rates.rb
Normal 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
2
spec/models/rate_spec.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
Reference in New Issue
Block a user