Class: CreateBestBoyReports

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/active_record/templates/create_best_boy_reports.rb

Class Method Summary collapse

Class Method Details

.downObject



26
27
28
29
# File 'lib/generators/active_record/templates/create_best_boy_reports.rb', line 26

def self.down
  drop_table :best_boy_month_reports
  drop_table :best_boy_day_reports
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/generators/active_record/templates/create_best_boy_reports.rb', line 2

def self.up
  create_table :best_boy_day_reports, :force => true do |t|
    t.string  :owner_type
    t.string  :event
    t.string  :event_source
    t.integer :month_report_id
    t.integer :occurrences, default: 0
    t.timestamps
  end
  add_index :best_boy_day_reports, [:owner_type, :event, :event_source], :name => :index_best_boy_day_reports_aggregated_columns
  add_index :best_boy_day_reports, :created_at
  add_index :best_boy_day_reports, :month_report_id

  create_table :best_boy_month_reports, :force => true do |t|
    t.string  :owner_type
    t.string  :event
    t.string  :event_source
    t.integer :occurrences, default: 0
    t.timestamps
  end
  add_index :best_boy_month_reports, [:owner_type, :event, :event_source], :name => :index_best_boy_month_reports_aggregated_columns
  add_index :best_boy_month_reports, :created_at
end