# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20130104141813) do

  create_table "active_admin_comments", :force => true do |t|
    t.string   "resource_id",   :null => false
    t.string   "resource_type", :null => false
    t.integer  "author_id"
    t.string   "author_type"
    t.text     "body"
    t.datetime "created_at",    :null => false
    t.datetime "updated_at",    :null => false
    t.string   "namespace"
  end

  add_index "active_admin_comments", ["author_type", "author_id"], :name => "index_active_admin_comments_on_author_type_and_author_id"
  add_index "active_admin_comments", ["namespace"], :name => "index_active_admin_comments_on_namespace"
  add_index "active_admin_comments", ["resource_type", "resource_id"], :name => "index_admin_notes_on_resource_type_and_resource_id"

  create_table "admin_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
    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
  end

  add_index "admin_users", ["email"], :name => "index_admin_users_on_email", :unique => true
  add_index "admin_users", ["reset_password_token"], :name => "index_admin_users_on_reset_password_token", :unique => true

  create_table "band_invitations", :id => false, :force => true do |t|
    t.string   "id",         :limit => 64, :null => false
    t.string   "user_id",    :limit => 64
    t.string   "band_id",    :limit => 64
    t.boolean  "accepted"
    t.string   "creator_id", :limit => 64
    t.datetime "created_at",               :null => false
    t.datetime "updated_at",               :null => false
  end

  create_table "bands", :id => false, :force => true do |t|
    t.string   "id",         :limit => 64,   :null => false
    t.string   "name",       :limit => 1024, :null => false
    t.string   "website",    :limit => 4000
    t.string   "biography",  :limit => 4000, :null => false
    t.datetime "created_at",                 :null => false
    t.datetime "updated_at",                 :null => false
    t.string   "city",       :limit => 100
    t.string   "state",      :limit => 2
    t.string   "country",    :limit => 100
    t.string   "photo_url",  :limit => 2048
    t.string   "logo_url",   :limit => 2048
  end

  create_table "bands_followers", :id => false, :force => true do |t|
    t.string   "id",          :limit => 64, :null => false
    t.string   "band_id",     :limit => 64, :null => false
    t.string   "follower_id", :limit => 64, :null => false
    t.datetime "created_at",                :null => false
    t.datetime "updated_at",                :null => false
  end

  add_index "bands_followers", ["band_id", "follower_id"], :name => "band_follower_uniqkey", :unique => true

  create_table "bands_genres", :id => false, :force => true do |t|
    t.string   "id",         :limit => 64, :null => false
    t.string   "band_id",    :limit => 64, :null => false
    t.string   "genre_id",   :limit => 64, :null => false
    t.datetime "created_at",               :null => false
    t.datetime "updated_at",               :null => false
  end

  add_index "bands_genres", ["band_id", "genre_id"], :name => "band_genre_uniqkey", :unique => true

  create_table "bands_likers", :id => false, :force => true do |t|
    t.string   "id",         :limit => 64, :null => false
    t.string   "band_id",    :limit => 64, :null => false
    t.string   "liker_id",   :limit => 64, :null => false
    t.datetime "created_at",               :null => false
    t.datetime "updated_at",               :null => false
  end

  add_index "bands_likers", ["band_id", "liker_id"], :name => "band_liker_uniqkey", :unique => true

  create_table "bands_musicians", :id => false, :force => true do |t|
    t.string   "id",         :limit => 64,                    :null => false
    t.string   "band_id",    :limit => 64,                    :null => false
    t.string   "user_id",    :limit => 64,                    :null => false
    t.boolean  "admin",                    :default => false, :null => false
    t.datetime "created_at",                                  :null => false
    t.datetime "updated_at",                                  :null => false
  end

  add_index "bands_musicians", ["band_id", "user_id"], :name => "band_musician_uniqkey", :unique => true

  create_table "bands_recordings", :id => false, :force => true do |t|
    t.string "band_id",      :limit => 64, :null => false
    t.string "recording_id", :limit => 64, :null => false
  end

  add_index "bands_recordings", ["band_id", "recording_id"], :name => "band_recording_uniqkey", :unique => true

  create_table "connections", :id => false, :force => true do |t|
    t.string   "id",               :limit => 64, :null => false
    t.string   "user_id",          :limit => 64
    t.string   "client_id",        :limit => 64, :null => false
    t.datetime "created_at",                     :null => false
    t.datetime "updated_at",                     :null => false
    t.string   "music_session_id", :limit => 64
    t.string   "ip_address",       :limit => 64
    t.boolean  "as_musician"
  end

  add_index "connections", ["client_id"], :name => "connections_client_id_key", :unique => true

  create_table "fan_invitations", :id => false, :force => true do |t|
    t.string   "id",               :limit => 64, :null => false
    t.string   "sender_id",        :limit => 64
    t.string   "receiver_id",      :limit => 64
    t.string   "music_session_id", :limit => 64
    t.datetime "created_at",                     :null => false
    t.datetime "updated_at",                     :null => false
  end

  create_table "friend_requests", :id => false, :force => true do |t|
    t.string   "id",         :limit => 64,   :null => false
    t.string   "user_id",    :limit => 64
    t.string   "friend_id",  :limit => 64
    t.datetime "created_at",                 :null => false
    t.datetime "updated_at",                 :null => false
    t.string   "status",     :limit => 50
    t.string   "message",    :limit => 4000
  end

  create_table "friendships", :id => false, :force => true do |t|
    t.string   "id",         :limit => 64, :null => false
    t.string   "user_id",    :limit => 64
    t.string   "friend_id",  :limit => 64
    t.datetime "created_at",               :null => false
    t.datetime "updated_at",               :null => false
  end

  add_index "friendships", ["user_id", "friend_id"], :name => "user_friend_uniqkey", :unique => true

  create_table "genres", :id => false, :force => true do |t|
    t.string   "id",          :limit => 64,   :null => false
    t.string   "description", :limit => 1024, :null => false
    t.datetime "created_at",                  :null => false
    t.datetime "updated_at",                  :null => false
  end

  create_table "genres_music_sessions", :id => false, :force => true do |t|
    t.string "id",               :limit => 64, :null => false
    t.string "genre_id",         :limit => 64
    t.string "music_session_id", :limit => 64
  end

  create_table "instruments", :id => false, :force => true do |t|
    t.string   "id",          :limit => 64,                  :null => false
    t.string   "description", :limit => 1024,                :null => false
    t.datetime "created_at",                                 :null => false
    t.datetime "updated_at",                                 :null => false
    t.integer  "popularity",                  :default => 0, :null => false
  end

  create_table "invitations", :id => false, :force => true do |t|
    t.string   "id",               :limit => 64, :null => false
    t.string   "sender_id",        :limit => 64
    t.string   "receiver_id",      :limit => 64
    t.string   "music_session_id", :limit => 64
    t.datetime "created_at",                     :null => false
    t.datetime "updated_at",                     :null => false
    t.string   "join_request_id",  :limit => 64
  end

  add_index "invitations", ["sender_id", "receiver_id", "music_session_id"], :name => "invitations_uniqkey", :unique => true

  create_table "join_requests", :id => false, :force => true do |t|
    t.string   "id",               :limit => 64,   :null => false
    t.string   "user_id",          :limit => 64
    t.string   "music_session_id", :limit => 64
    t.string   "text",             :limit => 2000
    t.datetime "created_at",                       :null => false
    t.datetime "updated_at",                       :null => false
  end

  add_index "join_requests", ["user_id", "music_session_id"], :name => "user_music_session_uniqkey", :unique => true

  create_table "max_mind", :id => false, :force => true do |t|
    t.integer "ip_bottom"
    t.integer "ip_top"
    t.string  "country",   :limit => 64
    t.string  "region",    :limit => 64
    t.string  "city"
  end

  add_index "max_mind", ["ip_bottom"], :name => "max_mind_ip_bottom_idx"
  add_index "max_mind", ["ip_top"], :name => "max_mind_ip_top_idx"

  create_table "music_sessions", :id => false, :force => true do |t|
    t.string   "id",                :limit => 64,   :null => false
    t.string   "description",       :limit => 8000
    t.string   "user_id",           :limit => 64,   :null => false
    t.datetime "created_at",                        :null => false
    t.datetime "updated_at",                        :null => false
    t.boolean  "musician_access",                   :null => false
    t.string   "band_id",           :limit => 64
    t.boolean  "approval_required",                 :null => false
    t.boolean  "fan_access",                        :null => false
    t.boolean  "fan_chat",                          :null => false
  end

  create_table "music_sessions_comments", :id => false, :force => true do |t|
    t.string   "id",               :limit => 64,   :null => false
    t.string   "music_session_id", :limit => 64,   :null => false
    t.string   "creator_id",       :limit => 64,   :null => false
    t.string   "comment",          :limit => 4000, :null => false
    t.datetime "created_at",                       :null => false
    t.datetime "updated_at",                       :null => false
  end

  create_table "music_sessions_history", :id => false, :force => true do |t|
    t.string   "id",                 :limit => 64,   :null => false
    t.string   "music_session_id",   :limit => 64,   :null => false
    t.string   "description",        :limit => 8000
    t.string   "user_id",            :limit => 64,   :null => false
    t.string   "band_id",            :limit => 64
    t.string   "genres"
    t.datetime "created_at",                         :null => false
    t.datetime "session_removed_at"
  end

  add_index "music_sessions_history", ["music_session_id"], :name => "music_session_uniqkey", :unique => true

  create_table "music_sessions_likers", :id => false, :force => true do |t|
    t.string   "id",               :limit => 64, :null => false
    t.string   "music_session_id", :limit => 64, :null => false
    t.string   "liker_id",         :limit => 64, :null => false
    t.datetime "created_at",                     :null => false
    t.datetime "updated_at",                     :null => false
  end

  add_index "music_sessions_likers", ["music_session_id", "liker_id"], :name => "music_sessions_liker_uniqkey", :unique => true

  create_table "music_sessions_user_history", :id => false, :force => true do |t|
    t.string   "id",               :limit => 64, :null => false
    t.string   "music_session_id", :limit => 64, :null => false
    t.string   "user_id",          :limit => 64, :null => false
    t.string   "client_id",        :limit => 64, :null => false
    t.datetime "created_at",                     :null => false
  end

  create_table "musicians_instruments", :id => false, :force => true do |t|
    t.string   "id",                :limit => 64,                :null => false
    t.string   "user_id",           :limit => 64,                :null => false
    t.string   "instrument_id",     :limit => 64,                :null => false
    t.integer  "proficiency_level", :limit => 2,                 :null => false
    t.integer  "priority",          :limit => 2,  :default => 1, :null => false
    t.datetime "created_at",                                     :null => false
    t.datetime "updated_at",                                     :null => false
  end

  add_index "musicians_instruments", ["user_id", "instrument_id"], :name => "musician_instrument_uniqkey", :unique => true

  create_table "musicians_recordings", :id => false, :force => true do |t|
    t.string "user_id",      :limit => 64, :null => false
    t.string "recording_id", :limit => 64, :null => false
  end

  add_index "musicians_recordings", ["user_id", "recording_id"], :name => "musician_recording_uniqkey", :unique => true

  create_table "recordings", :id => false, :force => true do |t|
    t.string   "id",          :limit => 64,                    :null => false
    t.string   "description", :limit => 200,                   :null => false
    t.boolean  "public",                     :default => true, :null => false
    t.datetime "created_at",                                   :null => false
    t.datetime "updated_at",                                   :null => false
    t.string   "creator_id",  :limit => 64,                    :null => false
    t.string   "updater_id",  :limit => 64,                    :null => false
  end

  create_table "recordings_comments", :id => false, :force => true do |t|
    t.string   "id",           :limit => 64,   :null => false
    t.string   "recording_id", :limit => 64,   :null => false
    t.string   "creator_id",   :limit => 64,   :null => false
    t.string   "comment",      :limit => 4000, :null => false
    t.datetime "created_at",                   :null => false
    t.datetime "updated_at",                   :null => false
  end

  create_table "recordings_downloads", :id => false, :force => true do |t|
    t.string   "id",            :limit => 64, :null => false
    t.string   "recording_id",  :limit => 64, :null => false
    t.string   "downloader_id", :limit => 64, :null => false
    t.datetime "created_at",                  :null => false
    t.datetime "updated_at",                  :null => false
  end

  create_table "recordings_genres", :id => false, :force => true do |t|
    t.string "recording_id", :limit => 64, :null => false
    t.string "genre_id",     :limit => 64, :null => false
  end

  add_index "recordings_genres", ["recording_id", "genre_id"], :name => "recording_genre_uniqkey", :unique => true

  create_table "recordings_likers", :id => false, :force => true do |t|
    t.string   "id",           :limit => 64, :null => false
    t.string   "recording_id", :limit => 64, :null => false
    t.string   "liker_id",     :limit => 64, :null => false
    t.datetime "created_at",                 :null => false
    t.datetime "updated_at",                 :null => false
  end

  add_index "recordings_likers", ["recording_id", "liker_id"], :name => "recording_liker_uniqkey", :unique => true

  create_table "recordings_plays", :id => false, :force => true do |t|
    t.string   "id",           :limit => 64, :null => false
    t.string   "recording_id", :limit => 64, :null => false
    t.string   "player_id",    :limit => 64, :null => false
    t.datetime "created_at",                 :null => false
    t.datetime "updated_at",                 :null => false
  end

  create_table "sessions_plays", :id => false, :force => true do |t|
    t.string   "id",               :limit => 64, :null => false
    t.string   "music_session_id", :limit => 64, :null => false
    t.string   "player_id",        :limit => 64, :null => false
    t.datetime "created_at",                     :null => false
    t.datetime "updated_at",                     :null => false
  end

  create_table "tracks", :id => false, :force => true do |t|
    t.string   "id",            :limit => 64, :null => false
    t.string   "connection_id", :limit => 64
    t.string   "instrument_id", :limit => 64
    t.string   "sound",         :limit => 64, :null => false
    t.datetime "created_at",                  :null => false
    t.datetime "updated_at",                  :null => false
  end

  create_table "user_authorizations", :id => false, :force => true do |t|
    t.string   "id",               :limit => 64, :null => false
    t.string   "user_id",          :limit => 64
    t.string   "uid",                            :null => false
    t.string   "provider",                       :null => false
    t.string   "token"
    t.datetime "token_expiration"
    t.datetime "created_at",                     :null => false
    t.datetime "updated_at",                     :null => false
  end

  add_index "user_authorizations", ["user_id"], :name => "user_authorizations_user_id_idx"

  create_table "users", :id => false, :force => true do |t|
    t.string   "id",                           :limit => 64,                      :null => false
    t.string   "email",                                                           :null => false
    t.string   "remember_token"
    t.string   "password_digest",                                                 :null => false
    t.boolean  "admin",                                        :default => false, :null => false
    t.datetime "created_at",                                                      :null => false
    t.datetime "updated_at",                                                      :null => false
    t.boolean  "musician",                                     :default => false, :null => false
    t.string   "city",                         :limit => 100
    t.string   "state",                        :limit => 100
    t.string   "country",                      :limit => 100
    t.string   "first_name",                   :limit => 50,                      :null => false
    t.string   "last_name",                    :limit => 50,                      :null => false
    t.date     "birth_date"
    t.string   "gender",                       :limit => 1,    :default => "M",   :null => false
    t.string   "internet_service_provider",    :limit => 50
    t.string   "signup_token"
    t.boolean  "email_confirmed",                              :default => false
    t.string   "photo_url",                    :limit => 2048
    t.string   "session_settings",             :limit => 4000
    t.string   "reset_password_token",         :limit => 64
    t.datetime "reset_password_token_created"
    t.boolean  "can_invite",                                   :default => true,  :null => false
  end

  add_index "users", ["email"], :name => "users_email_key", :unique => true
  add_index "users", ["remember_token"], :name => "remember_token_idx"
  add_index "users", ["remember_token"], :name => "users_remember_token_key", :unique => true
  add_index "users", ["signup_token"], :name => "users_signup_token_key", :unique => true

  create_table "users_favorites", :id => false, :force => true do |t|
    t.string   "id",           :limit => 64, :null => false
    t.string   "user_id",      :limit => 64, :null => false
    t.string   "recording_id", :limit => 64, :null => false
    t.datetime "created_at",                 :null => false
    t.datetime "updated_at",                 :null => false
  end

  add_index "users_favorites", ["user_id", "recording_id"], :name => "user_favorite_uniqkey", :unique => true

  create_table "users_followers", :id => false, :force => true do |t|
    t.string   "id",          :limit => 64, :null => false
    t.string   "user_id",     :limit => 64, :null => false
    t.string   "follower_id", :limit => 64, :null => false
    t.datetime "created_at",                :null => false
    t.datetime "updated_at",                :null => false
  end

  add_index "users_followers", ["user_id", "follower_id"], :name => "user_follower_uniqkey", :unique => true

  create_table "users_likers", :id => false, :force => true do |t|
    t.string   "id",         :limit => 64, :null => false
    t.string   "user_id",    :limit => 64, :null => false
    t.string   "liker_id",   :limit => 64, :null => false
    t.datetime "created_at",               :null => false
    t.datetime "updated_at",               :null => false
  end

  add_index "users_likers", ["user_id", "liker_id"], :name => "user_liker_uniqkey", :unique => true

end
