| 20130113004653_create_reportable_cache.rb - warvox - VoIP based wardialing tool… | |
| git clone git://jay.scot/warvox | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| 20130113004653_create_reportable_cache.rb (1204B) | |
| --- | |
| 1 class CreateReportableCache < ActiveRecord::Migration[5.0] | |
| 2 def up | |
| 3 create_table :reportable_cache, force: true do |t| | |
| 4 t.string :model_name, null: false, limit: 100 | |
| 5 t.string :report_name, null: false, limit: 100 | |
| 6 t.string :grouping, null: false, limit: 10 | |
| 7 t.string :aggregation, null: false, limit: 10 | |
| 8 t.string :conditions, null: false, limit: 100 | |
| 9 t.float :value, null: false, default:… | |
| 10 t.datetime :reporting_period, null: false | |
| 11 | |
| 12 t.timestamps null: false | |
| 13 end | |
| 14 | |
| 15 add_index :reportable_cache, [ | |
| 16 :model_name, | |
| 17 :report_name, | |
| 18 :grouping, | |
| 19 :aggregation, | |
| 20 :conditions | |
| 21 ], name: :name_model_grouping_agregation | |
| 22 add_index :reportable_cache, [ | |
| 23 :model_name, | |
| 24 :report_name, | |
| 25 :grouping, | |
| 26 :aggregation, | |
| 27 :conditions, | |
| 28 :reporting_period | |
| 29 ], unique: true, name: :name_model_grouping_aggregation_period | |
| 30 end | |
| 31 | |
| 32 def self.down | |
| 33 remove_index :reportable_cache, name: :name_model_grouping_agregation | |
| 34 remove_index :reportable_cache, name: :name_model_grouping_aggregati… | |
| 35 | |
| 36 drop_table :reportable_cache | |
| 37 end | |
| 38 | |
| 39 end |