Sha256: 2114d59466055f34306356741e4dc86a48500fc67729bcec94db6f5eb6094ff5

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

require 'active_support/core_ext'
require 'active_record'
require 'fileutils'

tmpdir = File.join(File.dirname(__FILE__), '..', '..', 'tmp')
FileUtils.mkdir(tmpdir) unless File.exist?(tmpdir)
test_db = File.join(tmpdir, 'test.db')

connection_spec = {
  :adapter => 'sqlite3',
  :database => test_db
}

# Delete any existing instance of the test database
FileUtils.rm test_db, :force => true

# Create a new test database
ActiveRecord::Base.establish_connection(connection_spec)

# ActiveRecord::Base.connection.initialize_schema_migrations_table

class CreateMeasurements < ActiveRecord::Migration
  def self.up
    create_table :system_metrics, :force => true do |t|
      t.string :name
      t.string :action
      t.string :category
      t.datetime :started_at
      t.string :transaction_id
      t.text :payload
      t.float :duration
      t.float :exclusive_duration
      t.integer :request_id
      t.integer :parent_id
    end
  end

  def self.down
    drop_table :system_metrics
  end
end

CreateMeasurements.up

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
system-metrics-0.2.5 spec/support/db_setup.rb
system-metrics-0.2.4 spec/support/db_setup.rb
system-metrics-0.2.3 spec/support/db_setup.rb
system-metrics-0.2.2 spec/support/db_setup.rb
system-metrics-0.2.1 spec/support/db_setup.rb
system-metrics-0.2.0 spec/support/db_setup.rb