# 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 => 20110926031740) do

  create_table "album_formats", :force => true do |t|
    t.integer "album_id"
    t.integer "release_format_id"
  end

  add_index "album_formats", ["album_id"], :name => "index_album_formats_on_album_id"
  add_index "album_formats", ["release_format_id"], :name => "index_album_formats_on_release_format_id"

  create_table "album_genres", :force => true do |t|
    t.integer "album_id"
    t.integer "genre_id"
  end

  add_index "album_genres", ["album_id"], :name => "index_album_genres_on_album_id"
  add_index "album_genres", ["genre_id"], :name => "index_album_genres_on_genre_id"

  create_table "album_styles", :force => true do |t|
    t.integer "album_id"
    t.integer "style_id"
  end

  add_index "album_styles", ["album_id"], :name => "index_album_styles_on_album_id"
  add_index "album_styles", ["style_id"], :name => "index_album_styles_on_style_id"

  create_table "albums", :force => true do |t|
    t.string   "name"
    t.integer  "artist_id"
    t.integer  "year"
    t.string   "pic_url"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "album_type"
    t.string   "mbid"
    t.integer  "has_pic"
    t.integer  "status"
    t.boolean  "master"
    t.integer  "master_id"
  end

  add_index "albums", ["artist_id"], :name => "index_albums_on_artist_id"
  add_index "albums", ["has_pic"], :name => "index_albums_on_has_pic"
  add_index "albums", ["master"], :name => "index_albums_on_master"
  add_index "albums", ["name"], :name => "index_albums_on_name"
  add_index "albums", ["year"], :name => "index_albums_on_year"

  create_table "artist_aliases", :force => true do |t|
    t.integer "artist_id"
    t.string  "name"
  end

  add_index "artist_aliases", ["artist_id"], :name => "index_artist_aliases_on_artist_id"
  add_index "artist_aliases", ["name"], :name => "index_artist_aliases_on_name"

  create_table "artist_links", :force => true do |t|
    t.integer "artist_id"
    t.string  "service"
    t.string  "url"
  end

  add_index "artist_links", ["artist_id"], :name => "index_artist_links_on_artist_id"

  create_table "artists", :force => true do |t|
    t.string   "name"
    t.text     "desc"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "pic_url"
    t.string   "artist_type"
    t.string   "mbid"
    t.integer  "status"
    t.integer  "listeners"
    t.integer  "approved"
    t.string   "original_name"
  end

  add_index "artists", ["listeners"], :name => "index_artists_on_listeners"
  add_index "artists", ["name"], :name => "index_artists_on_name"
  add_index "artists", ["original_name"], :name => "index_artists_on_original_name"
  add_index "artists", ["status"], :name => "index_artists_on_status"

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

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

  create_table "favorites", :force => true do |t|
    t.integer  "user_id"
    t.integer  "artist_id"
    t.integer  "album_id"
    t.integer  "track_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

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

  create_table "local_brainz_cached_releases", :force => true do |t|
    t.string   "mbid"
    t.string   "title"
    t.string   "status"
    t.date     "date"
    t.string   "country"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "album_id"
    t.string   "format"
  end

  create_table "local_brainz_cached_tracks", :force => true do |t|
    t.integer  "position"
    t.string   "recording_id"
    t.string   "title"
    t.integer  "length"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "release_id"
  end

  create_table "playlist_items", :force => true do |t|
    t.integer  "playlist_id"
    t.integer  "track_id"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "playlists", :force => true do |t|
    t.integer  "user_id"
    t.string   "name"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

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

  add_index "release_formats", ["hash"], :name => "index_release_formats_on_hash"

  create_table "sessions", :force => true do |t|
    t.integer  "user_id"
    t.string   "key"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "sessions", ["key"], :name => "index_sessions_on_key"
  add_index "sessions", ["user_id"], :name => "index_sessions_on_user_id"

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

  create_table "track_artists", :force => true do |t|
    t.integer "track_id"
    t.integer "artist_id"
    t.boolean "main"
    t.string  "join"
    t.string  "name"
  end

  add_index "track_artists", ["artist_id"], :name => "index_track_artists_on_artist_id"
  add_index "track_artists", ["main"], :name => "index_track_artists_on_main"
  add_index "track_artists", ["track_id"], :name => "index_track_artists_on_track_id"

  create_table "tracks", :force => true do |t|
    t.string   "name"
    t.integer  "album_id"
    t.integer  "position"
    t.integer  "bonus"
    t.integer  "live"
    t.integer  "acoustic"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "length"
    t.string   "country"
    t.string   "mbid"
  end

  add_index "tracks", ["album_id"], :name => "index_tracks_on_album_id"
  add_index "tracks", ["bonus"], :name => "index_tracks_on_bonus"
  add_index "tracks", ["name"], :name => "index_tracks_on_name"
  add_index "tracks", ["position"], :name => "index_tracks_on_position"

  create_table "users", :force => true do |t|
    t.string   "name"
    t.string   "email"
    t.integer  "vkid"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.string   "lastfm_key"
    t.string   "lastfm_username"
    t.string   "lang"
    t.integer  "music"
  end

  add_index "users", ["name"], :name => "index_users_on_name"
  add_index "users", ["vkid"], :name => "index_users_on_vkid"

end