Making more messes with mashes, maps, and requesters. Maybe a teensy

bit closer on the tournament pairing algorithm (???)  ActiveRecord
associations are kind of a pain, btw.
This commit is contained in:
Dan Buch
2012-03-09 00:24:48 -05:00
parent ec6d9d5146
commit 8ad33d18b7
10 changed files with 123 additions and 29 deletions

View File

@@ -1,21 +1,21 @@
class CreateMashes < ActiveRecord::Migration
def self.up
create_table :mashes do |t|
t.string :requester, :null => false
t.integer :map_a, :null => false
t.integer :map_b, :null => false
t.integer :winner, :null => false
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.timestamps
end
add_index :mashes, [:winner]
add_index :mashes, [:requester]
add_index :mashes, [:winner_id]
add_index :mashes, [:requester_id]
end
def self.down
remove_index :mashes, [:winner]
remove_index :mashes, [:requester]
remove_index :mashes, [:winner_id]
remove_index :mashes, [:requester_id]
drop_table :mashes
end
end

View File

@@ -0,0 +1,13 @@
class CreateRequesters < ActiveRecord::Migration
def self.up
create_table :requesters do |t|
t.string :ip
t.timestamps
end
end
def self.down
drop_table :requesters
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 => 20120304164625) do
ActiveRecord::Schema.define(:version => 20120309000749) do
create_table "maps", :force => true do |t|
t.string "name", :null => false
@@ -22,15 +22,21 @@ ActiveRecord::Schema.define(:version => 20120304164625) do
add_index "maps", ["points"], :name => "index_maps_on_points"
create_table "mashes", :force => true do |t|
t.string "requester", :null => false
t.integer "map_a", :null => false
t.integer "map_b", :null => false
t.integer "winner", :null => false
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.datetime "created_at"
t.datetime "updated_at"
end
add_index "mashes", ["requester"], :name => "index_mashes_on_requester"
add_index "mashes", ["winner"], :name => "index_mashes_on_winner"
add_index "mashes", ["requester_id"], :name => "index_mashes_on_requester_id"
add_index "mashes", ["winner_id"], :name => "index_mashes_on_winner_id"
create_table "requesters", :force => true do |t|
t.string "ip"
t.datetime "created_at"
t.datetime "updated_at"
end
end