Sha256: e0498cb5ba39bf0dd9afcced728a7e515528bfff01d97d65792d1f634c79260c

Contents?: true

Size: 756 Bytes

Versions: 1

Compression:

Stored size: 756 Bytes

Contents

class CreateNanoMetricsTables < ActiveRecord::Migration
  def up
    create_table :nano_metrics do |t|
      t.integer  :context_id, null: false
      t.datetime :time,       null: false
      t.timestamps
    end

    add_index :nano_metrics, :context_id

    create_table :nano_contexts do |t|
      t.string  :action,         null: false
      t.string  :metricable_type, null: false
      t.integer :metricable_id,   null: false
    end

    add_index :nano_contexts, :action
    add_index :nano_contexts, [:metricable_type, :metricable_id]
    add_index :nano_contexts, [:action, :metricable_type, :metricable_id],
      unique: true, name: 'unique_nano_contexts'
  end

  def down
    drop_table :nano_contexts
    drop_table :nano_metrics
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nano_metrics-0.0.1 db/migrate/1_create_nano_metrics_tables.rb