BUSTED: what a mess. trying to get tournament round generation bits working. ack.

This commit is contained in:
Dan Buch
2012-03-10 08:47:47 -05:00
parent f0297f3101
commit 8ec802a2bf
19 changed files with 241 additions and 387 deletions

View File

@@ -1,21 +1,22 @@
class CreateMashes < ActiveRecord::Migration
def self.up
create_table :mashes do |t|
t.integer :requester_id, :null => false
t.integer :map_a_id, :null => false
t.integer :map_b_id, :null => false
t.integer :winner_id, :null => false
t.integer :mash_tournament_id, :null => false
t.integer :map_a_id
t.integer :map_b_id
t.integer :winner_id
t.integer :mash_tournament_round_id
t.timestamps
end
add_index :mashes, [:winner_id]
add_index :mashes, [:requester_id]
add_index :mashes, [:mash_tournament_id]
end
def self.down
remove_index :mashes, [:winner_id]
remove_index :mashes, [:requester_id]
remove_index :mashes, [:mash_tournament_id]
drop_table :mashes
end
end

View File

@@ -2,15 +2,18 @@ class CreateMashTournaments < ActiveRecord::Migration
def self.up
create_table :mash_tournaments do |t|
t.references :requester, :null => false
t.integer :total_rounds, :default => 1
t.timestamps
end
add_index :mash_tournaments, [:requester_id]
add_index :mash_tournaments, [:total_rounds]
end
def self.down
drop_table :mash_tournaments
remove_index :mash_tournaments, [:total_rounds]
remove_index :mash_tournaments, [:requester_id]
drop_table :mash_tournaments
end
end

View File

@@ -0,0 +1,20 @@
class CreateMashTournamentRounds < ActiveRecord::Migration
def self.up
create_table :mash_tournament_rounds do |t|
t.references :mash_tournament
t.integer :number, :null => false
t.integer :mash_count, :null => false
t.timestamps
end
add_index :mash_tournament_rounds, [:mash_tournament_id, :number]
add_index :mash_tournament_rounds, [:mash_count]
end
def self.down
remove_index :mash_tournament_rounds, [:mash_tournament_id, :number]
remove_index :mash_tournament_rounds, [:mash_count]
drop_table :mash_tournament_rounds
end
end

View File

@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120309130609) do
ActiveRecord::Schema.define(:version => 20120310035133) do
create_table "maps", :force => true do |t|
t.string "name", :null => false
@@ -21,24 +21,38 @@ ActiveRecord::Schema.define(:version => 20120309130609) do
add_index "maps", ["name"], :name => "index_maps_on_name"
add_index "maps", ["points"], :name => "index_maps_on_points"
create_table "mash_tournament_rounds", :force => true do |t|
t.integer "mash_tournament_id"
t.integer "number", :null => false
t.integer "mash_count", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "mash_tournament_rounds", ["mash_count"], :name => "index_mash_tournament_rounds_on_mash_count"
add_index "mash_tournament_rounds", ["mash_tournament_id", "number"], :name => "index_mash_tournament_rounds_on_mash_tournament_id_and_number"
create_table "mash_tournaments", :force => true do |t|
t.integer "requester_id", :null => false
t.integer "requester_id", :null => false
t.integer "total_rounds", :default => 1
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "mash_tournaments", ["requester_id"], :name => "index_mash_tournaments_on_requester_id"
add_index "mash_tournaments", ["total_rounds"], :name => "index_mash_tournaments_on_total_rounds"
create_table "mashes", :force => true do |t|
t.integer "requester_id", :null => false
t.integer "map_a_id", :null => false
t.integer "map_b_id", :null => false
t.integer "winner_id", :null => false
t.integer "mash_tournament_id", :null => false
t.integer "map_a_id"
t.integer "map_b_id"
t.integer "winner_id"
t.integer "mash_tournament_round_id"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "mashes", ["requester_id"], :name => "index_mashes_on_requester_id"
add_index "mashes", ["mash_tournament_id"], :name => "index_mashes_on_mash_tournament_id"
add_index "mashes", ["winner_id"], :name => "index_mashes_on_winner_id"
create_table "requesters", :force => true do |t|