class AddMerryGoRoundAggregations
Public Instance Methods
change()
click to toggle source
# File lib/rails/generators/merry_go_round/install/templates/add_aggregations.rb, line 2 def change create_table :merry_go_round_aggregations do |t| # The name of whatever you're tracking t.string :key, null: false # The integer value of your count t.integer :value, null: false, default: 0 # When it was counted rounded to a normalized time t.datetime :timestamp, null: false # A string representing the granularity (minute, hour, day, week, month, year) t.string :granularity, null: false # Foreign key for tree structure t.integer :parent_id end add_index :merry_go_round_aggregations, [:granularity, :timestamp, :key, :parent_id], name: 'merry_go_round_aggregations_kgtp' add_index :merry_go_round_aggregations, [:parent_id, :granularity, :timestamp], name: 'merry_go_round_aggregations_pgt' end