migration.rb - reportable - Fork of reportable required by WarVox, from hdm/reportable.
(HTM) git clone git://jay.scot/reportable
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
migration.rb (1250B)
---
1 class CreateReportableCache < ActiveRecord::Migration
2
3 def self.up
4 create_table :reportable_cache, :force => true do |t|
5 t.string :model_name, :null => false, :limit => 100
6 t.string :report_name, :null => false, :limit => 100
7 t.string :grouping, :null => false, :limit => 10
8 t.string :aggregation, :null => false, :limit => 10
9 t.string :conditions, :null => false, :limit => 100
10 t.float :value, :null => false, :default => 0
11 t.datetime :reporting_period, :null => false
12
13 t.timestamps
14 end
15
16 add_index :reportable_cache, [
17 :model_name,
18 :report_name,
19 :grouping,
20 :aggregation,
21 :conditions
22 ], :name => :name_model_grouping_agregation
23 add_index :reportable_cache, [
24 :model_name,
25 :report_name,
26 :grouping,
27 :aggregation,
28 :conditions,
29 :reporting_period
30 ], :unique => true, :name => :name_model_grouping_aggregation_period
31 end
32
33 def self.down
34 remove_index :reportable_cache, :name => :name_model_grouping_agregation
35 remove_index :reportable_cache, :name => :name_model_grouping_aggregation_period
36
37 drop_table :reportable_cache
38 end
39
40 end