class CreatesEverything < ActiveRecord::Migration
  def up
    create_table "arena_run_cards", :force => true do |t|
      t.integer  "arena_run_id"
      t.integer  "card_id"
      t.boolean  "golden"
      t.datetime "created_at",   :null => false
      t.datetime "updated_at",   :null => false
    end

    add_index "arena_run_cards", ["arena_run_id"], :name => "index_arena_run_cards_on_arena_run_id"
    add_index "arena_run_cards", ["card_id"], :name => "index_arena_run_cards_on_card_id"

    create_table "arena_runs", :force => true do |t|
      t.integer  "user_id"
      t.integer  "gold",       :default => 0
      t.integer  "dust",       :default => 0
      t.boolean  "complete",   :default => false
      t.datetime "created_at",                        :null => false
      t.datetime "updated_at",                        :null => false
      t.text     "notes"
      t.string   "patch",      :default => "current"
      t.integer  "klass_id"
    end

    add_index "arena_runs", ["user_id"], :name => "index_arena_runs_on_user_id"

    create_table "arenas", :force => true do |t|
      t.datetime "created_at",                      :null => false
      t.datetime "updated_at",                      :null => false
      t.integer  "user_id"
      t.string   "userclass",    :default => "N/A"
      t.string   "oppclass",     :default => "N/A"
      t.boolean  "win",          :default => false
      t.boolean  "gofirst",      :default => true
      t.integer  "arena_run_id"
      t.text     "notes"
      t.string   "oppname"
    end

    add_index "arenas", ["arena_run_id"], :name => "index_arenas_on_arena_run_id"
    add_index "arenas", ["user_id"], :name => "index_arenas_on_user_id"

    create_table "card_sets", :force => true do |t|
      t.string "name"
      t.text   "notes"
    end

    create_table "cards", :force => true do |t|
      t.string  "name"
      t.string  "description"
      t.integer "attack"
      t.integer "health"
      t.integer "card_set_id"
      t.integer "rarity_id"
      t.integer "type_id"
      t.integer "klass_id"
      t.integer "race_id"
      t.integer "mana"
      t.boolean "collectible"
      t.integer "patch_id"
      t.string  "blizz_id"
    end

    add_index "cards", ["name"], :name => "index_cards_on_name"
    add_index "cards", ["type_id"], :name => "index_cards_on_type_id"

    create_table "comments", :force => true do |t|
      t.integer  "owner_id",         :null => false
      t.integer  "commentable_id",   :null => false
      t.string   "commentable_type", :null => false
      t.text     "body",             :null => false
      t.datetime "created_at",       :null => false
      t.datetime "updated_at",       :null => false
    end


    create_table "conversations", :force => true do |t|
      t.string   "subject",    :default => ""
      t.datetime "created_at",                 :null => false
      t.datetime "updated_at",                 :null => false
    end

    create_table "deck_versions", :force => true do |t|
      t.integer  "deck_id"
      t.text     "notes"
      t.integer  "version"
      t.datetime "created_at", :null => false
      t.datetime "updated_at", :null => false
      t.string   "cardstring"
    end

    add_index "deck_versions", ["deck_id"], :name => "index_deck_versions_on_deck_id"

    create_table "decks", :force => true do |t|
      t.string   "name"
      t.datetime "created_at",       :null => false
      t.datetime "updated_at",       :null => false
      t.integer  "user_id"
      t.string   "slug"
      t.text     "notes"
      t.integer  "slot"
      t.boolean  "active"
      t.integer  "klass_id"
      t.string   "cardstring"
      t.integer  "unique_deck_id"
      t.integer  "user_num_matches"
      t.integer  "user_num_wins"
      t.integer  "user_num_losses"
      t.float    "user_winrate"
      t.boolean  "is_public"
    end

    add_index "decks", ["klass_id"], :name => "index_decks_on_klass_id"
    add_index "decks", ["slug"], :name => "index_decks_on_slug"
    add_index "decks", ["unique_deck_id"], :name => "index_decks_on_unique_deck_id"
    add_index "decks", ["user_id"], :name => "index_decks_on_user_id"

    create_table "delayed_jobs", :force => true do |t|
      t.integer  "priority",   :default => 0, :null => false
      t.integer  "attempts",   :default => 0, :null => false
      t.text     "handler",                   :null => false
      t.text     "last_error"
      t.datetime "run_at"
      t.datetime "locked_at"
      t.datetime "failed_at"
      t.string   "locked_by"
      t.string   "queue"
      t.datetime "created_at",                :null => false
      t.datetime "updated_at",                :null => false
    end

    add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"

    create_table "impressions", :force => true do |t|
      t.string   "impressionable_type"
      t.integer  "impressionable_id"
      t.integer  "user_id"
      t.string   "controller_name"
      t.string   "action_name"
      t.string   "view_name"
      t.string   "request_hash"
      t.string   "ip_address"
      t.string   "session_hash"
      t.text     "message"
      t.text     "referrer"
      t.datetime "created_at",          :null => false
      t.datetime "updated_at",          :null => false
    end

    add_index "impressions", ["controller_name", "action_name", "ip_address"], :name => "controlleraction_ip_index"
    add_index "impressions", ["controller_name", "action_name", "request_hash"], :name => "controlleraction_request_index"
    add_index "impressions", ["controller_name", "action_name", "session_hash"], :name => "controlleraction_session_index"
    add_index "impressions", ["impressionable_type", "impressionable_id", "ip_address"], :name => "poly_ip_index"
    add_index "impressions", ["impressionable_type", "impressionable_id", "request_hash"], :name => "poly_request_index"
    add_index "impressions", ["impressionable_type", "impressionable_id", "session_hash"], :name => "poly_session_index"
    add_index "impressions", ["impressionable_type", "message", "impressionable_id"], :name => "impressionable_type_message_index", :length => {"impressionable_type"=>nil, "message"=>255, "impressionable_id"=>nil}
    add_index "impressions", ["user_id"], :name => "index_impressions_on_user_id"

    create_table "klasses", :force => true do |t|
      t.string "name"
    end

    create_table "match_decks", :force => true do |t|
      t.integer  "deck_id"
      t.integer  "match_id"
      t.datetime "created_at", :null => false
      t.datetime "updated_at", :null => false
    end

    add_index "match_decks", ["deck_id"], :name => "index_match_decks_on_deck_id"
    add_index "match_decks", ["match_id"], :name => "index_match_decks_on_match_id"

    create_table "match_ranks", :force => true do |t|
      t.integer  "rank_id"
      t.integer  "match_id"
      t.datetime "created_at", :null => false
      t.datetime "updated_at", :null => false
      t.integer  "legendary"
    end

    add_index "match_ranks", ["match_id"], :name => "index_match_ranks_on_match_id"
    add_index "match_ranks", ["rank_id"], :name => "index_match_ranks_on_rank_id"

    create_table "match_results", :force => true do |t|
      t.integer  "match_id"
      t.string   "name"
      t.datetime "created_at", :null => false
      t.datetime "updated_at", :null => false
    end

    add_index "match_results", ["match_id"], :name => "index_match_results_on_match_id"

    create_table "match_runs", :force => true do |t|
      t.integer  "arena_run_id"
      t.integer  "match_id"
      t.datetime "created_at",   :null => false
      t.datetime "updated_at",   :null => false
    end

    add_index "match_runs", ["arena_run_id"], :name => "index_match_runs_on_arena_run_id"
    add_index "match_runs", ["match_id"], :name => "index_match_runs_on_match_id"

    create_table "match_unique_decks", :force => true do |t|
      t.integer  "unique_deck_id"
      t.integer  "match_id"
      t.datetime "created_at",     :null => false
      t.datetime "updated_at",     :null => false
    end

    add_index "match_unique_decks", ["match_id"], :name => "index_match_unique_decks_on_match_id"
    add_index "match_unique_decks", ["unique_deck_id"], :name => "index_match_unique_decks_on_unique_deck_id"

    create_table "matches", :force => true do |t|
      t.integer  "user_id"
      t.integer  "klass_id"
      t.integer  "oppclass_id"
      t.string   "oppname"
      t.integer  "mode_id"
      t.integer  "result_id"
      t.text     "notes"
      t.datetime "created_at",  :null => false
      t.datetime "updated_at",  :null => false
      t.boolean  "coin"
      t.integer  "numturns"
      t.integer  "duration"
      t.integer  "patch_id"
      t.integer  "season_id"
      t.boolean  "appsubmit"
    end

    add_index "matches", ["klass_id"], :name => "index_matches_on_klass_id"
    add_index "matches", ["mode_id"], :name => "index_matches_on_mode_id"
    add_index "matches", ["oppclass_id"], :name => "index_matches_on_oppclass_id"
    add_index "matches", ["result_id"], :name => "index_matches_on_result_id"
    add_index "matches", ["user_id"], :name => "index_matches_on_user_id"

    create_table "modes", :force => true do |t|
      t.string "name"
    end

    create_table "patches", :force => true do |t|
      t.string   "num"
      t.text     "changelog"
      t.datetime "created_at", :null => false
      t.datetime "updated_at", :null => false
    end

    create_table "profiles", :force => true do |t|
      t.string   "name"
      t.string   "bnetid"
      t.boolean  "private",              :default => false
      t.datetime "created_at",                              :null => false
      t.datetime "updated_at",                              :null => false
      t.integer  "user_id"
      t.integer  "bnetnum",              :default => 0
      t.string   "time_zone",            :default => "EST"
      t.string   "avatar_file_name"
      t.string   "avatar_content_type"
      t.integer  "avatar_file_size"
      t.datetime "avatar_updated_at"
      t.string   "locale",               :default => "en"
      t.string   "sig_pic_file_name"
      t.string   "sig_pic_content_type"
      t.integer  "sig_pic_file_size"
      t.datetime "sig_pic_updated_at"
    end

    add_index "profiles", ["name"], :name => "index_profiles_on_name"
    add_index "profiles", ["user_id"], :name => "index_profiles_on_user_id"

    create_table "races", :force => true do |t|
      t.string   "name"
      t.datetime "created_at", :null => false
      t.datetime "updated_at", :null => false
    end

    create_table "ranks", :force => true do |t|
      t.string   "name"
      t.integer  "order"
      t.datetime "created_at", :null => false
      t.datetime "updated_at", :null => false
    end

    create_table "rarities", :force => true do |t|
      t.integer  "card_id"
      t.string   "rarity"
      t.datetime "created_at", :null => false
      t.datetime "updated_at", :null => false
    end

    create_table "redactor_assets", :force => true do |t|
      t.integer  "user_id"
      t.string   "data_file_name",                  :null => false
      t.string   "data_content_type"
      t.integer  "data_file_size"
      t.integer  "assetable_id"
      t.string   "assetable_type",    :limit => 30
      t.string   "type",              :limit => 30
      t.integer  "width"
      t.integer  "height"
      t.datetime "created_at",                      :null => false
      t.datetime "updated_at",                      :null => false
    end

    add_index "redactor_assets", ["assetable_type", "assetable_id"], :name => "idx_redactor_assetable"
    add_index "redactor_assets", ["assetable_type", "type", "assetable_id"], :name => "idx_redactor_assetable_type"

    create_table "seasons", :force => true do |t|
      t.integer  "num"
      t.datetime "created_at", :null => false
      t.datetime "updated_at", :null => false
      t.string   "name"
    end

    create_table "shortened_urls", :force => true do |t|
      t.integer  "owner_id"
      t.string   "owner_type", :limit => 20
      t.string   "url",                                     :null => false
      t.string   "unique_key", :limit => 10,                :null => false
      t.integer  "use_count",                :default => 0, :null => false
      t.datetime "created_at",                              :null => false
      t.datetime "updated_at",                              :null => false
    end

    add_index "shortened_urls", ["owner_id", "owner_type"], :name => "index_shortened_urls_on_owner_id_and_owner_type"
    add_index "shortened_urls", ["unique_key"], :name => "index_shortened_urls_on_unique_key", :unique => true
    add_index "shortened_urls", ["url"], :name => "index_shortened_urls_on_url"

    create_table "subscriptions", :force => true do |t|
      t.string "name"
      t.float  "cost"
    end

    create_table "taggings", :force => true do |t|
      t.integer  "tag_id"
      t.integer  "taggable_id"
      t.string   "taggable_type"
      t.integer  "tagger_id"
      t.string   "tagger_type"
      t.string   "context",       :limit => 128
      t.datetime "created_at"
    end

    add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], :name => "taggings_idx", :unique => true

    create_table "tags", :force => true do |t|
      t.string  "name"
      t.integer "taggings_count", :default => 0
    end

    add_index "tags", ["name"], :name => "index_tags_on_name", :unique => true

    create_table "team_users", :force => true do |t|
      t.integer "user_id"
      t.integer "team_id"
    end

    create_table "teams", :force => true do |t|
      t.string   "name"
      t.text     "description"
      t.datetime "created_at",  :null => false
      t.datetime "updated_at",  :null => false
    end

    create_table "types", :force => true do |t|
      t.string "name"
    end

    create_table "unique_deck_cards", :force => true do |t|
      t.integer  "unique_deck_id"
      t.integer  "card_id"
      t.datetime "created_at",     :null => false
      t.datetime "updated_at",     :null => false
    end

    add_index "unique_deck_cards", ["card_id"], :name => "index_unique_deck_cards_on_card_id"
    add_index "unique_deck_cards", ["unique_deck_id"], :name => "index_unique_deck_cards_on_unique_deck_id"

    create_table "unique_decks", :force => true do |t|
      t.string   "cardstring"
      t.integer  "klass_id"
      t.integer  "num_matches"
      t.integer  "num_wins"
      t.integer  "num_losses"
      t.integer  "num_minions"
      t.integer  "num_spells"
      t.integer  "num_weapons"
      t.datetime "last_played"
      t.datetime "created_at",  :null => false
      t.datetime "updated_at",  :null => false
      t.float    "winrate"
      t.integer  "num_users"
      t.integer  "mana_cost"
    end

    add_index "unique_decks", ["cardstring"], :name => "index_unique_decks_on_cardstring"

    create_table "users", :force => true do |t|
      t.string   "email",                  :default => "", :null => false
      t.string   "encrypted_password",     :default => "", :null => false
      t.string   "reset_password_token"
      t.datetime "reset_password_sent_at"
      t.datetime "remember_created_at"
      t.integer  "sign_in_count",          :default => 0,  :null => false
      t.datetime "current_sign_in_at"
      t.datetime "last_sign_in_at"
      t.string   "current_sign_in_ip"
      t.string   "last_sign_in_ip"
      t.datetime "created_at",                             :null => false
      t.datetime "updated_at",                             :null => false
      t.integer  "tourny_id"
      t.boolean  "guest"
      t.string   "userkey"
      t.integer  "subscription_id"
      t.string   "authentication_token"
    end

    add_index "users", ["email"], :name => "index_users_on_email", :unique => true
    add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
    add_index "users", ["tourny_id"], :name => "index_users_on_tourny_id"
    add_index "users", ["userkey"], :name => "index_users_on_userkey"

  end
end
