Introduction
Introduction Statistics Contact Development Disclaimer Help
fixed migration template - reportable - Fork of reportable required by WarVox, …
Log
Files
Refs
README
---
commit 9b3e0fbf0b0e4f88f328442a701097b7b4a9b81b
parent 543bb388afda3d3d580d4e18e86d005a5529f2e4
Author: Marco Otte-Witte <[email protected]>
Date: Wed, 14 Jan 2009 00:00:17 +0800
fixed migration template
Signed-off-by: Marco Otte-Witte <[email protected]>
Diffstat:
M generators/reports_as_sparkline_mi… | 51 ++++++++++++++++++---------…
1 file changed, 30 insertions(+), 21 deletions(-)
---
diff --git a/generators/reports_as_sparkline_migration/templates/migration.erb …
@@ -1,27 +1,36 @@
class <%= class_name %> < ActiveRecord::Migration
- 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.datetime :reporting_period, :null => false
+ 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 :grouping, :null => false
+ t.string :aggregation, :null => false
+ t.float :value, :null => false, :default => 0
+ t.datetime :reporting_period, :null => false
- t.timestamps
+ 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
+
+ def self.down
+ remove_index :name_model_grouping_agregation
+ remove_index :name_model_grouping_aggregation_period
+
+ drop_table :report_caches
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
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.