# This file is autogenerated. Instead of editing this file, please use the
# migrations feature of ActiveRecord to incrementally modify your database, and
# then regenerate this schema definition.

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

  create_table "casts", :force => true do |t|
    t.column "movie_id", :integer, :default => 0, :null => false
    t.column "person_id", :integer, :default => 0, :null => false
    t.column "position", :integer, :default => 999, :null => false
    t.column "type", :string, :limit => 64
    t.column "character_id", :integer, :default => 0
    t.column "version", :integer
    t.column "comment", :string, :default => ""
    t.column "job_id", :integer, :default => 0, :null => false
    t.column "lead", :boolean, :default => false
  end

  add_index "casts", ["movie_id"], :name => "movie_id"
  add_index "casts", ["type"], :name => "type"
  add_index "casts", ["person_id"], :name => "person_id"
  add_index "casts", ["type"], :name => "type_2"
  add_index "casts", ["movie_id", "type"], :name => "movie_id_and_type"
  add_index "casts", ["character_id"], :name => "character_id"
  add_index "casts", ["movie_id", "job_id"], :name => "casts_movie_and_job_index"
  add_index "casts", ["person_id", "job_id"], :name => "casts_person_and_job_index"

  create_table "categories", :force => true do |t|
    t.column "parent_id", :integer
    t.column "popularity", :integer, :default => 0
    t.column "assignable", :boolean, :default => true
    t.column "slug", :string
  end

  add_index "categories", ["parent_id"], :name => "categories_parent_index"

  create_table "category_dependencies_view", :force => true do |t|
    t.column "Movie", :binary
  end

  create_table "character_dependencies_view", :force => true do |t|
    t.column "Movie", :binary
  end

  create_table "characters", :force => true do |t|
    t.column "name", :string, :limit => 100, :default => "", :null => false
    t.column "popularity", :integer, :default => 0, :null => false
    t.column "version", :integer
  end

  create_table "companies", :force => true do |t|
    t.column "name", :string, :limit => 128, :default => "", :null => false
    t.column "popularity", :integer, :default => 0, :null => false
    t.column "parent_id", :integer
  end

  add_index "companies", ["parent_id"], :name => "companies_parent_id_index"

  create_table "company_dependencies_view", :force => true do |t|
    t.column "Movie", :binary
  end

  create_table "content_versions", :force => true do |t|
    t.column "content_id", :integer
    t.column "version", :integer
    t.column "language_id", :integer, :default => 0
    t.column "data", :text
    t.column "page_name", :string, :limit => 100, :default => ""
    t.column "name", :string, :limit => 100
    t.column "versioned_type", :string, :limit => 50
    t.column "updated_at", :datetime
    t.column "user_id", :integer, :default => 0
    t.column "comment", :string
    t.column "ip", :string
    t.column "category_alias_id", :integer
    t.column "locked", :boolean
    t.column "related_object_id", :integer
    t.column "related_object_type", :string
    t.column "data_html", :text
    t.column "html_updated_at", :datetime
    t.column "created_at", :datetime
  end

  add_index "content_versions", ["content_id"], :name => "content_versions_content_id_index"

  create_table "contents", :force => true do |t|
    t.column "language_id", :integer, :default => 0, :null => false
    t.column "data", :text, :default => "", :null => false
    t.column "page_name", :string, :limit => 100, :default => "", :null => false
    t.column "type", :string, :limit => 50
    t.column "name", :string, :limit => 100
    t.column "version", :integer
    t.column "user_id", :integer, :default => 0
    t.column "comment", :string
    t.column "ip", :string
    t.column "locked", :boolean, :default => false
    t.column "related_object_id", :integer
    t.column "related_object_type", :string
    t.column "data_html", :text
    t.column "html_updated_at", :datetime
    t.column "creator_id", :integer
  end

  add_index "contents", ["related_object_id", "related_object_type", "language_id"], :name => "content_pages"

  create_table "country_dependencies_view", :force => true do |t|
    t.column "Movie", :binary
  end

  create_table "frozen_attributes", :id => false, :force => true do |t|
    t.column "object_type", :string, :default => "", :null => false
    t.column "object_id", :integer, :default => 0, :null => false
    t.column "attribute", :string, :default => "", :null => false
  end

  add_index "frozen_attributes", ["object_type", "object_id", "attribute"], :name => "frozen_attributes_object_type_index"

  create_table "globalize_countries", :force => true do |t|
    t.column "code", :string, :limit => 2
    t.column "english_name", :string
    t.column "date_format", :string
    t.column "currency_format", :string
    t.column "currency_code", :string, :limit => 3
    t.column "thousands_sep", :string, :limit => 2
    t.column "decimal_sep", :string, :limit => 2
    t.column "currency_decimal_sep", :string, :limit => 2
    t.column "number_grouping_scheme", :string
  end

  add_index "globalize_countries", ["code"], :name => "globalize_countries_code_index"

  create_table "globalize_languages", :force => true do |t|
    t.column "iso_639_1", :string, :limit => 2
    t.column "iso_639_2", :string, :limit => 3
    t.column "iso_639_3", :string, :limit => 3
    t.column "rfc_3066", :string
    t.column "english_name", :string
    t.column "english_name_locale", :string
    t.column "english_name_modifier", :string
    t.column "native_name", :string
    t.column "native_name_locale", :string
    t.column "native_name_modifier", :string
    t.column "macro_language", :boolean
    t.column "direction", :string
    t.column "pluralization", :string
    t.column "scope", :string, :limit => 1
  end

  add_index "globalize_languages", ["iso_639_1"], :name => "globalize_languages_iso_639_1_index"
  add_index "globalize_languages", ["iso_639_2"], :name => "globalize_languages_iso_639_2_index"
  add_index "globalize_languages", ["iso_639_3"], :name => "globalize_languages_iso_639_3_index"
  add_index "globalize_languages", ["rfc_3066"], :name => "globalize_languages_rfc_3066_index"

  create_table "globalize_translations", :force => true do |t|
    t.column "type", :string
    t.column "tr_key", :string
    t.column "table_name", :string
    t.column "item_id", :integer
    t.column "facet", :string
    t.column "language_id", :integer
    t.column "pluralization_index", :integer
    t.column "text", :text
    t.column "built_in", :boolean
  end

  add_index "globalize_translations", ["tr_key", "language_id"], :name => "globalize_translations_tr_key_index"
  add_index "globalize_translations", ["table_name", "item_id", "language_id"], :name => "globalize_translations_table_name_index"

  create_table "image_versions", :force => true do |t|
    t.column "image_id", :integer
    t.column "version", :integer
    t.column "data", :binary
    t.column "content_type", :string
    t.column "original_filename", :string
    t.column "source", :string, :limit => 1000
    t.column "related_object_type", :string
    t.column "related_object_id", :integer
    t.column "license", :integer, :default => 0
    t.column "user_id", :integer
    t.column "updated_at", :datetime
  end

  create_table "images", :force => true do |t|
    t.column "data", :binary
    t.column "content_type", :string
    t.column "original_filename", :string
    t.column "source", :string, :limit => 1000
    t.column "related_object_type", :string
    t.column "related_object_id", :integer
    t.column "license", :integer, :default => 0
    t.column "user_id", :integer
    t.column "version", :integer
  end

  add_index "images", ["related_object_id", "related_object_type"], :name => "images_related_object_id_index"
  add_index "images", ["license"], :name => "images_license_index"
  add_index "images", ["user_id"], :name => "images_user_id_index"

  create_table "jobs", :force => true do |t|
    t.column "parent_id", :integer
    t.column "type", :string, :limit => 12
    t.column "default_job_id", :integer
    t.column "popularity", :integer, :default => 0
  end

  add_index "jobs", ["parent_id"], :name => "jobs_parent_id_index"
  add_index "jobs", ["type"], :name => "jobs_type_index"
  add_index "jobs", ["popularity"], :name => "job_popularity"

  create_table "log_entries", :force => true do |t|
    t.column "attribute", :string, :default => "", :null => false
    t.column "old_value", :text
    t.column "new_value", :text
    t.column "related_object_type", :string, :default => "", :null => false
    t.column "related_object_id", :integer, :default => 0, :null => false
    t.column "user_id", :integer
    t.column "ip_address", :string
    t.column "comment", :string
    t.column "created_at", :datetime
    t.column "type", :string
    t.column "reverted", :boolean, :default => false
    t.column "language_id", :integer
  end

  add_index "log_entries", ["related_object_type", "related_object_id"], :name => "related_object_index"

  create_table "movie_countries", :id => false, :force => true do |t|
    t.column "movie_id", :integer, :default => 0, :null => false
    t.column "country_id", :integer, :default => 0, :null => false
    t.column "position", :integer, :default => 999, :null => false
  end

  add_index "movie_countries", ["country_id"], :name => "country_id"
  add_index "movie_countries", ["movie_id"], :name => "movie_id"

  create_table "movie_dependencies_view", :force => true do |t|
    t.column "Category", :binary
    t.column "Company", :binary
    t.column "Country", :binary
    t.column "Character", :binary
    t.column "Person", :binary
  end

  create_table "movie_languages", :id => false, :force => true do |t|
    t.column "movie_id", :integer, :default => 0, :null => false
    t.column "language_id", :integer, :default => 0, :null => false
    t.column "position", :integer, :default => 9999, :null => false
  end

  add_index "movie_languages", ["movie_id", "language_id"], :name => "movie_language_index"

  create_table "movie_references", :force => true do |t|
    t.column "type", :string, :limit => 50
    t.column "movie_id", :integer, :default => 0, :null => false
    t.column "referenced_id", :integer, :default => 0, :null => false
    t.column "position", :integer, :default => 999, :null => false
    t.column "version", :integer
  end

  add_index "movie_references", ["movie_id"], :name => "movie_id"
  add_index "movie_references", ["referenced_id"], :name => "referenced_id"
  add_index "movie_references", ["movie_id"], :name => "reference_movie_id"
  add_index "movie_references", ["referenced_id"], :name => "referenced_movie_id"

  create_table "movie_user_categories", :force => true do |t|
    t.column "category_id", :integer
    t.column "movie_id", :integer
    t.column "user_id", :integer
    t.column "value", :integer, :default => 1
  end

  add_index "movie_user_categories", ["movie_id"], :name => "movie_index"
  add_index "movie_user_categories", ["category_id"], :name => "category_index"

  create_table "movie_user_tags", :force => true do |t|
    t.column "user_id", :integer
    t.column "movie_id", :integer
    t.column "tag", :string
  end

  add_index "movie_user_tags", ["user_id", "tag"], :name => "movie_user_tags_user_id_index"

  create_table "movies", :force => true do |t|
    t.column "parent_id", :integer
    t.column "name", :string, :limit => 100, :default => "", :null => false
    t.column "type", :string, :limit => 32, :default => "Movie"
    t.column "start", :date
    t.column "end", :date
    t.column "runtime", :integer, :default => 0, :null => false
    t.column "inherit_cast", :boolean, :default => false, :null => false
    t.column "inherit_genres", :boolean, :default => false, :null => false
    t.column "position", :integer, :default => 9999, :null => false
    t.column "vote", :float, :default => 0.0, :null => false
    t.column "budget", :integer, :default => 0
    t.column "revenue", :integer, :default => 0
    t.column "status", :string, :default => "Released", :null => false
    t.column "popularity", :integer, :default => 0, :null => false
    t.column "version", :integer
    t.column "homepage", :string, :limit => 100, :default => ""
    t.column "created_at", :datetime
    t.column "edit_status", :string, :default => "Abandoned", :null => false
    t.column "votes_count", :integer, :default => 0
    t.column "reviews_count", :integer, :default => 0
    t.column "movie_of_the_day", :date
    t.column "creator_id", :integer
    t.column "series_type", :string, :default => "season_based"
    t.column "season_type", :string, :default => "regular"
  end

  add_index "movies", ["movie_of_the_day"], :name => "movies_movie_of_the_day_index"
  add_index "movies", ["parent_id"], :name => "movie_parent_index"

  create_table "name_aliases", :force => true do |t|
    t.column "name", :string, :limit => 1000
    t.column "language_id", :integer
    t.column "position", :integer, :default => 9999
    t.column "alias_type", :string
    t.column "version", :integer
    t.column "related_object_type", :string
    t.column "related_object_id", :integer
    t.column "official_translation", :boolean, :default => false
  end

  add_index "name_aliases", ["related_object_type", "related_object_id"], :name => "related_object_idx"
  add_index "name_aliases", ["related_object_id", "related_object_type", "language_id"], :name => "related_object_language_idx"
  add_index "name_aliases", ["related_object_id", "related_object_type", "language_id", "official_translation"], :name => "official_translation_idx"

  create_table "people", :force => true do |t|
    t.column "name", :string, :limit => 100, :default => "", :null => false
    t.column "birthday", :date
    t.column "homepage", :string, :default => "", :null => false
    t.column "birthplace", :string, :default => "", :null => false
    t.column "popularity", :integer, :default => 0, :null => false
    t.column "version", :integer
    t.column "deathday", :date
    t.column "edit_status", :string, :default => "Abandoned", :null => false
    t.column "person_of_the_day", :date
  end

  add_index "people", ["name"], :name => "name"
  add_index "people", ["person_of_the_day"], :name => "person_of_the_day_index"

  create_table "person_dependencies_view", :force => true do |t|
    t.column "Movie", :binary
  end

  create_table "popularities", :force => true do |t|
    t.column "created_at", :datetime, :null => false
    t.column "for_type", :string, :limit => 50, :default => "", :null => false
    t.column "for_id", :integer, :default => 0, :null => false
    t.column "language_id", :integer, :default => 0, :null => false
  end

  create_table "production_companies", :force => true do |t|
    t.column "movie_id", :integer, :default => 0, :null => false
    t.column "company_id", :integer, :default => 0, :null => false
    t.column "position", :integer, :default => 9999, :null => false
    t.column "type", :string, :limit => 64
  end

  add_index "production_companies", ["movie_id"], :name => "movie_id"
  add_index "production_companies", ["company_id"], :name => "company_id"
  add_index "production_companies", ["movie_id", "type"], :name => "movie_and_type"
  add_index "production_companies", ["company_id", "type"], :name => "company_and_type"

  create_table "rating_histories", :force => true do |t|
    t.column "rating", :float, :default => 0.0
    t.column "type", :string
    t.column "related_object_type", :string
    t.column "related_object_id", :integer
    t.column "start_date", :date
    t.column "end_date", :date
    t.column "created_at", :datetime, :null => false
    t.column "updated_at", :datetime, :null => false
  end

  create_table "reviews", :force => true do |t|
    t.column "user_id", :integer, :default => 0, :null => false
    t.column "movie_id", :integer, :default => 0, :null => false
    t.column "data", :text
    t.column "created_at", :datetime, :null => false
    t.column "updated_at", :datetime
    t.column "rating", :integer
    t.column "title", :string
    t.column "language_id", :integer
  end

  create_table "search_logs", :force => true do |t|
    t.column "query", :string
    t.column "results", :integer
    t.column "method", :string
    t.column "created_at", :datetime
  end

  create_table "track_backs", :force => true do |t|
    t.column "url", :string, :default => "", :null => false
    t.column "title", :string
    t.column "excerpt", :string
    t.column "blog_name", :string
    t.column "language_id", :integer
    t.column "is_spam", :boolean, :default => false
    t.column "tracked_object_type", :string, :default => "", :null => false
    t.column "tracked_object_id", :integer, :default => 0, :null => false
    t.column "created_at", :datetime
  end

  create_table "trailers", :force => true do |t|
    t.column "key", :string, :default => "", :null => false
    t.column "source", :string, :default => "youtube", :null => false
    t.column "movie_id", :integer, :default => 0, :null => false
    t.column "language_id", :integer, :default => 0, :null => false
  end

  create_table "users", :force => true do |t|
    t.column "login", :string
    t.column "email", :string
    t.column "name", :string
    t.column "crypted_password", :string, :limit => 40
    t.column "salt", :string, :limit => 40
    t.column "is_editor", :boolean
    t.column "is_admin", :boolean
    t.column "updated_at", :datetime
    t.column "created_at", :datetime
    t.column "remember_token", :string
    t.column "remember_token_expires_at", :datetime
    t.column "activation_code", :string, :limit => 40
    t.column "activated_at", :datetime
    t.column "password_reset_code", :string, :limit => 40
    t.column "date_of_birth", :date
    t.column "country_id", :integer
    t.column "language_id", :integer
    t.column "is_chiefeditor", :boolean, :default => false
    t.column "gender", :integer
    t.column "permalink", :string
  end

  add_index "users", ["login"], :name => "login_index"
  add_index "users", ["email"], :name => "email_index"

  create_table "votes", :force => true do |t|
    t.column "type", :string, :limit => 32, :default => "", :null => false
    t.column "ip", :string, :limit => 16, :default => "", :null => false
    t.column "user_id", :integer, :default => 0, :null => false
    t.column "vote", :integer, :limit => 4, :default => 0, :null => false
    t.column "movie_id", :integer, :default => 0, :null => false
    t.column "created_at", :datetime, :null => false
    t.column "updated_at", :datetime, :null => false
  end

  add_index "votes", ["movie_id", "user_id"], :name => "votes_default_index"

end
