updated migration template - reportable - Fork of reportable required by WarVox, from hdm/reportable.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit dce778951a2e3f254ecd0de4845dbf732c53ae2b
(DIR) parent f9df5dd39ba665417bbfb88a42950fc2ad4ba78e
(HTM) Author: marcoow <marco.otte-witte@simplabs.com>
Date: Fri, 12 Dec 2008 01:47:56 +0800
updated migration template
Signed-off-by: Marco Otte-Witte <marco.otte-witte@simplabs.com>
Diffstat:
M generators/reports_as_sparkline_mi… | 47 ++++++++++++++-----------------
1 file changed, 21 insertions(+), 26 deletions(-)
---
(DIR) diff --git a/generators/reports_as_sparkline_migration/templates/migration.erb b/generators/reports_as_sparkline_migration/templates/migration.erb
@@ -1,32 +1,27 @@
class <%= class_name %> < ActiveRecord::Migration
- def self.up
- create_table :report_caches, :force => true do |t|
- t.string :model_name, :null => false
- t.string :report_name, :null => false
- t.string :report_grouping, :null => false
- t.float :value, :null => false, :default => 0
- t.datetime :reporting_period, :null => false
+ create_table :report_caches, :force => true do |t|
+ t.string :model_name, :null => false
+ t.string :report_name, :null => false
+ t.string :grouping, :null => false
+ t.string :aggregation, :null => false
+ t.float :value, :null => false, :default => 0
+ t.string :reporting_period, :null => false
- t.timestamps
- end
- add_index :report_caches, [
- :model_name,
- :report_name,
- :report_grouping
- ], :name => 'name_klass_grouping'
- add_index :report_caches, [
- :model_name, :report_name,
- :report_grouping,
- :reporting_period
- ], :unique => true, :name => 'report_caches_name_klass_grouping_period'
- end
-
- def self.down
- remove_index :report_caches, :name_klass_grouping
- remove_index :report_caches, :report_caches_name_klass_grouping_period
-
- drop_table :report_caches
+ t.timestamps
end
+ add_index :report_caches, [
+ :model_name,
+ :report_name,
+ :grouping,
+ :aggregation
+ ], :name => 'name_model_grouping_agregation'
+ add_index :report_caches, [
+ :model_name,
+ :report_name,
+ :grouping,
+ :aggregation,
+ :reporting_period
+ ], :unique => true, :name => 'name_model_grouping_aggregation_period'
end