# 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. # # This file is the source Rails uses to define your schema when running `bin/rails # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to # be faster and is potentially less error prone than running all of your # migrations from scratch. Old migrations may fail to apply correctly if those # migrations use external dependencies or application code. # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema[8.1].define(version: 2025_10_31_022926) do create_table "external_ids", force: :cascade do |t| t.datetime "created_at", null: false t.integer "source", null: false t.datetime "updated_at", null: false t.string "value", null: false t.integer "work_id", null: false t.index ["source", "value"], name: "index_external_ids_on_source_and_value", unique: true t.index ["work_id", "source"], name: "index_external_ids_on_work_id_and_source", unique: true t.index ["work_id"], name: "index_external_ids_on_work_id" end create_table "playback_sessions", force: :cascade do |t| t.boolean "completed", default: false t.datetime "created_at", null: false t.float "duration_watched", default: 0.0 t.datetime "last_watched_at" t.integer "play_count", default: 0 t.float "position", default: 0.0 t.datetime "updated_at", null: false t.integer "user_id", null: false t.integer "video_id", null: false t.index ["last_watched_at"], name: "index_playback_sessions_on_last_watched_at" t.index ["user_id"], name: "index_playback_sessions_on_user_id" t.index ["video_id", "user_id"], name: "index_playback_sessions_on_video_id_and_user_id", unique: true t.index ["video_id"], name: "index_playback_sessions_on_video_id" end create_table "sessions", force: :cascade do |t| t.datetime "created_at", null: false t.string "ip_address" t.datetime "updated_at", null: false t.string "user_agent" t.integer "user_id", null: false t.index ["user_id"], name: "index_sessions_on_user_id" end create_table "storage_locations", force: :cascade do |t| t.datetime "created_at", null: false t.boolean "enabled", default: true t.datetime "last_scanned_at" t.integer "location_type", default: 0, null: false t.string "name", null: false t.string "path" t.integer "priority", default: 0 t.boolean "scan_subdirectories", default: true t.text "settings" t.datetime "updated_at", null: false t.boolean "writable", default: false t.index ["enabled"], name: "index_storage_locations_on_enabled" t.index ["location_type"], name: "index_storage_locations_on_location_type" t.index ["name"], name: "index_storage_locations_on_name", unique: true t.index ["priority"], name: "index_storage_locations_on_priority" end create_table "users", force: :cascade do |t| t.datetime "created_at", null: false t.string "email_address", null: false t.string "password_digest", null: false t.datetime "updated_at", null: false t.index ["email_address"], name: "index_users_on_email_address", unique: true end create_table "video_assets", force: :cascade do |t| t.integer "asset_type", null: false t.datetime "created_at", null: false t.text "metadata" t.datetime "updated_at", null: false t.integer "video_id", null: false t.index ["video_id", "asset_type"], name: "index_video_assets_on_video_id_and_asset_type", unique: true t.index ["video_id"], name: "index_video_assets_on_video_id" end create_table "videos", force: :cascade do |t| t.string "audio_codec" t.integer "bit_rate" t.datetime "created_at", null: false t.float "duration" t.text "error_message" t.string "file_hash" t.string "file_path", null: false t.integer "file_size" t.string "filename" t.text "fingerprints" t.string "format" t.float "frame_rate" t.boolean "has_subtitles", default: false t.integer "height" t.boolean "imported", default: false t.text "metadata" t.boolean "processed" t.boolean "processing_failed", default: false t.text "processing_info" t.string "resolution_label" t.integer "source_type", default: 0, null: false t.string "source_url" t.integer "storage_location_id", null: false t.string "title" t.string "transcoded_path" t.boolean "transcoded_permanently" t.string "type", default: "Video", null: false t.datetime "updated_at", null: false t.string "version_type" t.string "video_codec" t.text "video_metadata" t.boolean "web_compatible" t.integer "width" t.integer "work_id" t.index ["file_hash"], name: "index_videos_on_file_hash" t.index ["imported"], name: "index_videos_on_imported" t.index ["source_type"], name: "index_videos_on_source_type" t.index ["storage_location_id", "file_path"], name: "index_videos_on_storage_location_id_and_file_path", unique: true t.index ["storage_location_id"], name: "index_videos_on_storage_location_id" t.index ["type"], name: "index_videos_on_type" t.index ["work_id", "resolution_label"], name: "index_videos_on_work_id_and_resolution_label" t.index ["work_id"], name: "index_videos_on_work_id" end create_table "works", force: :cascade do |t| t.string "backdrop_path" t.datetime "created_at", null: false t.text "custom_fields" t.text "description" t.string "director" t.text "imdb_data" t.text "metadata" t.boolean "organized", default: false t.string "poster_path" t.decimal "rating" t.string "title", null: false t.text "tmdb_data" t.datetime "updated_at", null: false t.integer "year" t.index ["organized"], name: "index_works_on_organized" t.index ["title", "year"], name: "index_works_on_title_and_year", unique: true t.index ["title"], name: "index_works_on_title" end add_foreign_key "external_ids", "works" add_foreign_key "playback_sessions", "users" add_foreign_key "playback_sessions", "videos" add_foreign_key "sessions", "users" add_foreign_key "video_assets", "videos" add_foreign_key "videos", "storage_locations" add_foreign_key "videos", "works" end