Module: AreWeThereYet::Persistence::Schema

Defined in:
lib/are_we_there_yet/persistence/schema.rb

Constant Summary collapse

@@tables =
{
  :runs => Proc.new {
    primary_key :id
    DateTime :started_at
    DateTime :ended_at
  },
  :metrics => Proc.new {
    primary_key :id
    String :path
    column :description, :text
    Float :execution_time
    DateTime :created_at
    Integer :run_id
    index :path
    index :description
  }
}

Class Method Summary collapse

Class Method Details

.create(connection) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/are_we_there_yet/persistence/schema.rb', line 21

def self.create(connection)
  if connection.tables.empty?
    connection.transaction do
      @@tables.each do |name,attributes|
        connection.create_table(name, &attributes)
      end
    end
  end
end