Class: CreateRaces

Inherits:
Sequel::Migration show all
Defined in:
lib/migrations/004_create_races.rb

Instance Method Summary collapse

Methods inherited from Sequel::Migration

apply, descendants, inherited, #initialize, #method_missing

Constructor Details

This class inherits a constructor from Sequel::Migration

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Sequel::Migration

Instance Method Details

#downObject


19
20
21
22
# File 'lib/migrations/004_create_races.rb', line 19

def down
  drop_table(:races)
  drop_table(:race_participations)
end

#upObject


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/migrations/004_create_races.rb', line 2

def up
  create_table :races do
    primary_key :id
    TrueClass :raced, :default => false
    Integer :tournament_id
  end
  create_table(:race_participations, :ignore_index_errors=>true) do
    primary_key :id
    BigDecimal :finish_time, :size=>[10, 0]
    Integer :racer_id, :null=>false
    Integer :race_id, :null=>false

    index [:race_id], :name=>:index_race_participations_race
    index [:racer_id], :name=>:index_race_participations_racer
  end
end