Class: CreateTournaments

Inherits:
Sequel::Migration
  • Object
show all
Defined in:
lib/migrations/005_create_tournaments.rb

Instance Method Summary collapse

Instance Method Details

#downObject



19
20
21
22
# File 'lib/migrations/005_create_tournaments.rb', line 19

def down
  drop_table(:tournaments)
  drop_table(:tournament_participations)
end

#upObject



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

def up
  create_table(:tournament_participations, :ignore_index_errors=>true) do
    primary_key :id
    TrueClass :eliminated
    Integer :racer_id, :null=>false
    Integer :tournament_id, :null=>false
    
    index [:racer_id], :name=>:index_tournament_participations_racer
    index [:tournament_id], :name=>:index_tournament_participations_tournament
  end
  
  create_table(:tournaments) do
    primary_key :id
    String :name, :size=> 140
  end
end