# 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: 2026_02_18_134459) do
  create_table "board_memberships", force: :cascade do |t|
    t.integer "board_id", null: false
    t.datetime "created_at", null: false
    t.datetime "joined_at", null: false
    t.integer "last_read_post_id"
    t.datetime "left_at"
    t.integer "participant_id", null: false
    t.datetime "updated_at", null: false
    t.index ["board_id", "participant_id"], name: "index_board_memberships_on_board_id_and_participant_id", unique: true
    t.index ["board_id"], name: "index_board_memberships_on_board_id"
    t.index ["participant_id"], name: "index_board_memberships_on_participant_id"
  end

  create_table "board_posts", force: :cascade do |t|
    t.integer "board_id", null: false
    t.text "body", null: false
    t.datetime "created_at", null: false
    t.integer "participant_id", null: false
    t.string "phase"
    t.datetime "updated_at", null: false
    t.index ["board_id"], name: "index_board_posts_on_board_id"
    t.index ["participant_id"], name: "index_board_posts_on_participant_id"
  end

  create_table "board_proposals", force: :cascade do |t|
    t.integer "board_id", null: false
    t.text "body", null: false
    t.datetime "created_at", null: false
    t.string "phase"
    t.integer "proposer_participant_id", null: false
    t.string "status", default: "pending", null: false
    t.datetime "updated_at", null: false
    t.index ["board_id"], name: "index_board_proposals_on_board_id"
    t.index ["proposer_participant_id"], name: "index_board_proposals_on_proposer_participant_id"
  end

  create_table "boards", force: :cascade do |t|
    t.string "board_type", default: "negotiation", null: false
    t.datetime "created_at", null: false
    t.integer "created_by_participant_id"
    t.integer "game_id", null: false
    t.boolean "is_public", default: false, null: false
    t.datetime "updated_at", null: false
    t.index ["board_type"], name: "index_boards_on_board_type"
    t.index ["game_id"], name: "index_boards_on_game_id"
  end

  create_table "games", force: :cascade do |t|
    t.string "auto_order_mode", default: "hold", null: false
    t.datetime "created_at", null: false
    t.boolean "is_solo_mode", default: false, null: false
    t.text "memo"
    t.datetime "next_deadline_at"
    t.integer "participants_count"
    t.string "password_digest"
    t.string "scoring_system"
    t.string "status", default: "recruiting", null: false
    t.string "title"
    t.string "turn_schedule"
    t.datetime "updated_at", null: false
    t.integer "victory_sc_count"
    t.integer "year_limit"
    t.index ["status"], name: "index_games_on_status"
  end

  create_table "participants", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.integer "game_id", null: false
    t.boolean "is_administrator", default: false, null: false
    t.boolean "orders_submitted", default: false, null: false
    t.string "power"
    t.datetime "updated_at", null: false
    t.integer "user_id", null: false
    t.index ["game_id", "power"], name: "index_participants_on_game_id_and_power", unique: true, where: "power IS NOT NULL"
    t.index ["game_id"], name: "index_participants_on_game_id"
    t.index ["user_id", "game_id"], name: "index_participants_on_user_id_and_game_id", unique: true
    t.index ["user_id"], name: "index_participants_on_user_id"
  end

  create_table "solid_cable_messages", force: :cascade do |t|
    t.binary "channel", limit: 1024, null: false
    t.integer "channel_hash", limit: 8, null: false
    t.datetime "created_at", null: false
    t.binary "payload", limit: 536870912, null: false
    t.index ["channel"], name: "index_solid_cable_messages_on_channel"
    t.index ["channel_hash"], name: "index_solid_cable_messages_on_channel_hash"
    t.index ["created_at"], name: "index_solid_cable_messages_on_created_at"
  end

  create_table "solid_queue_blocked_executions", force: :cascade do |t|
    t.string "concurrency_key", null: false
    t.datetime "created_at", null: false
    t.datetime "expires_at", null: false
    t.bigint "job_id", null: false
    t.integer "priority", default: 0, null: false
    t.string "queue_name", null: false
    t.index ["concurrency_key", "priority", "job_id"], name: "index_solid_queue_blocked_executions_for_release"
    t.index ["expires_at", "concurrency_key"], name: "index_solid_queue_blocked_executions_for_maintenance"
    t.index ["job_id"], name: "index_solid_queue_blocked_executions_on_job_id", unique: true
  end

  create_table "solid_queue_claimed_executions", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.bigint "job_id", null: false
    t.bigint "process_id"
    t.index ["job_id"], name: "index_solid_queue_claimed_executions_on_job_id", unique: true
    t.index ["process_id", "job_id"], name: "index_solid_queue_claimed_executions_on_process_id_and_job_id"
  end

  create_table "solid_queue_failed_executions", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.text "error"
    t.bigint "job_id", null: false
    t.index ["job_id"], name: "index_solid_queue_failed_executions_on_job_id", unique: true
  end

  create_table "solid_queue_jobs", force: :cascade do |t|
    t.string "active_job_id"
    t.text "arguments"
    t.string "class_name", null: false
    t.string "concurrency_key"
    t.datetime "created_at", null: false
    t.datetime "finished_at"
    t.integer "priority", default: 0, null: false
    t.string "queue_name", null: false
    t.datetime "scheduled_at"
    t.datetime "updated_at", null: false
    t.index ["active_job_id"], name: "index_solid_queue_jobs_on_active_job_id"
    t.index ["class_name"], name: "index_solid_queue_jobs_on_class_name"
    t.index ["finished_at"], name: "index_solid_queue_jobs_on_finished_at"
    t.index ["queue_name", "finished_at"], name: "index_solid_queue_jobs_for_filtering"
    t.index ["scheduled_at", "finished_at"], name: "index_solid_queue_jobs_for_alerting"
  end

  create_table "solid_queue_pauses", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.string "queue_name", null: false
    t.index ["queue_name"], name: "index_solid_queue_pauses_on_queue_name", unique: true
  end

  create_table "solid_queue_processes", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.string "hostname"
    t.string "kind", null: false
    t.datetime "last_heartbeat_at", null: false
    t.text "metadata"
    t.string "name", null: false
    t.integer "pid", null: false
    t.bigint "supervisor_id"
    t.index ["last_heartbeat_at"], name: "index_solid_queue_processes_on_last_heartbeat_at"
    t.index ["name", "supervisor_id"], name: "index_solid_queue_processes_on_name_and_supervisor_id", unique: true
    t.index ["supervisor_id"], name: "index_solid_queue_processes_on_supervisor_id"
  end

  create_table "solid_queue_ready_executions", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.bigint "job_id", null: false
    t.integer "priority", default: 0, null: false
    t.string "queue_name", null: false
    t.index ["job_id"], name: "index_solid_queue_ready_executions_on_job_id", unique: true
    t.index ["priority", "job_id"], name: "index_solid_queue_poll_all"
    t.index ["queue_name", "priority", "job_id"], name: "index_solid_queue_poll_by_queue"
  end

  create_table "solid_queue_recurring_executions", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.bigint "job_id", null: false
    t.datetime "run_at", null: false
    t.string "task_key", null: false
    t.index ["job_id"], name: "index_solid_queue_recurring_executions_on_job_id", unique: true
    t.index ["task_key", "run_at"], name: "index_solid_queue_recurring_executions_on_task_key_and_run_at", unique: true
  end

  create_table "solid_queue_recurring_tasks", force: :cascade do |t|
    t.text "arguments"
    t.string "class_name"
    t.string "command", limit: 2048
    t.datetime "created_at", null: false
    t.text "description"
    t.string "key", null: false
    t.integer "priority", default: 0
    t.string "queue_name"
    t.string "schedule", null: false
    t.boolean "static", default: true, null: false
    t.datetime "updated_at", null: false
    t.index ["key"], name: "index_solid_queue_recurring_tasks_on_key", unique: true
    t.index ["static"], name: "index_solid_queue_recurring_tasks_on_static"
  end

  create_table "solid_queue_scheduled_executions", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.bigint "job_id", null: false
    t.integer "priority", default: 0, null: false
    t.string "queue_name", null: false
    t.datetime "scheduled_at", null: false
    t.index ["job_id"], name: "index_solid_queue_scheduled_executions_on_job_id", unique: true
    t.index ["scheduled_at", "priority", "job_id"], name: "index_solid_queue_dispatch_all"
  end

  create_table "solid_queue_semaphores", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.datetime "expires_at", null: false
    t.string "key", null: false
    t.datetime "updated_at", null: false
    t.integer "value", default: 1, null: false
    t.index ["expires_at"], name: "index_solid_queue_semaphores_on_expires_at"
    t.index ["key", "value"], name: "index_solid_queue_semaphores_on_key_and_value"
    t.index ["key"], name: "index_solid_queue_semaphores_on_key", unique: true
  end

  create_table "turns", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.json "draw_votes"
    t.integer "game_id", null: false
    t.json "game_state"
    t.integer "number"
    t.json "orders"
    t.string "phase"
    t.json "possible_orders"
    t.text "svg_date"
    t.json "svg_orders"
    t.datetime "updated_at", null: false
    t.index ["game_id"], name: "index_turns_on_game_id"
  end

  create_table "users", force: :cascade do |t|
    t.boolean "admin", default: false, null: false
    t.datetime "created_at", null: false
    t.string "email", null: false
    t.string "password_digest", null: false
    t.datetime "updated_at", null: false
    t.string "username", null: false
    t.index ["email"], name: "index_users_on_email", unique: true
  end

  add_foreign_key "board_memberships", "boards"
  add_foreign_key "board_memberships", "participants"
  add_foreign_key "board_posts", "boards"
  add_foreign_key "board_posts", "participants"
  add_foreign_key "board_proposals", "boards"
  add_foreign_key "board_proposals", "participants", column: "proposer_participant_id"
  add_foreign_key "boards", "games"
  add_foreign_key "participants", "games"
  add_foreign_key "participants", "users"
  add_foreign_key "solid_queue_blocked_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
  add_foreign_key "solid_queue_claimed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
  add_foreign_key "solid_queue_failed_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
  add_foreign_key "solid_queue_ready_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
  add_foreign_key "solid_queue_recurring_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
  add_foreign_key "solid_queue_scheduled_executions", "solid_queue_jobs", column: "job_id", on_delete: :cascade
  add_foreign_key "turns", "games"
end
