Class: ActiveWarehouse::AggregateMetaData

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/active_warehouse/aggregate.rb

Overview

ActiveRecord object which stores meta data about the aggregate

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build_table(force = false) ⇒ Object

Build the underlying table. Set force to true to force the build of the table



210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/active_warehouse/aggregate.rb', line 210

def self.build_table(force=false)
  connection.drop_table(table_name) if force and table_exists?
  if !table_exists?
    connection.create_table(table_name) do |t|
      t.column :cube_name, :string
      t.column :dimension1, :string
      t.column :dimension1_hierarchy, :string
      t.column :dimension2, :string
      t.column :dimension2_hierarchy, :string
      t.column :created_at, :datetime
      t.column :populated_at, :datetime
    end
    connection.add_index table_name, :cube_name
  end
end

Instance Method Details

#keyObject



225
226
227
# File 'lib/active_warehouse/aggregate.rb', line 225

def key
  Aggregate.key(dimension1, dimension1_hierarchy, dimension2, dimension2_hierarchy)
end