# 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_06_05_000001) do
  # These are extensions that must be enabled in order to support this database
  enable_extension "pg_catalog.plpgsql"

  # Custom types defined in this database.
  # Note that some types may not work with other database engines. Be careful if changing database.
  create_enum "user_roles", ["user", "admin"]

  create_table "active_storage_attachments", force: :cascade do |t|
    t.bigint "blob_id", null: false
    t.datetime "created_at", null: false
    t.string "name", null: false
    t.bigint "record_id", null: false
    t.string "record_type", null: false
    t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
    t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
  end

  create_table "active_storage_blobs", force: :cascade do |t|
    t.bigint "byte_size", null: false
    t.string "checksum"
    t.string "content_type"
    t.datetime "created_at", null: false
    t.string "filename", null: false
    t.string "key", null: false
    t.text "metadata"
    t.string "service_name", null: false
    t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
  end

  create_table "active_storage_variant_records", force: :cascade do |t|
    t.bigint "blob_id", null: false
    t.string "variation_digest", null: false
    t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
  end

  create_table "answers", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.bigint "node_id"
    t.bigint "player_id"
    t.datetime "updated_at", null: false
    t.integer "value"
    t.index ["node_id"], name: "index_answers_on_node_id"
    t.index ["player_id"], name: "index_answers_on_player_id"
    t.index ["value"], name: "index_answers_on_value"
  end

  create_table "assets", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.text "tags", default: [], array: true
    t.text "title"
    t.datetime "updated_at", null: false
    t.index ["tags"], name: "index_assets_on_tags", using: :gin
  end

  create_table "attachments", force: :cascade do |t|
    t.bigint "asset_id"
    t.integer "attachable_for_id"
    t.text "attachable_for_type"
    t.jsonb "body", default: {}
    t.datetime "created_at", null: false
    t.boolean "is_favorite", default: false, null: false
    t.integer "position"
    t.jsonb "props", default: {}
    t.datetime "updated_at", null: false
    t.jsonb "url", default: {}
    t.index ["asset_id"], name: "index_attachments_on_asset_id"
    t.index ["attachable_for_id", "attachable_for_type"], name: "attachable_for"
    t.index ["is_favorite"], name: "index_attachments_on_is_favorite"
  end

  create_table "nodes", force: :cascade do |t|
    t.string "ancestry", null: false, collation: "C"
    t.integer "ancestry_depth", default: 0
    t.datetime "created_at", null: false
    t.text "excluded_locales", default: [], array: true
    t.datetime "expires_at"
    t.jsonb "href", default: {}
    t.boolean "is_allowlist", default: false
    t.jsonb "page_description", default: {}
    t.jsonb "page_title", default: {}
    t.integer "position"
    t.datetime "published_at"
    t.text "settings", default: [], array: true
    t.jsonb "slug", default: {}
    t.integer "status", default: 0
    t.jsonb "tags", default: {}
    t.integer "template", default: 0
    t.jsonb "title", default: {}
    t.datetime "updated_at", null: false
    t.jsonb "url", default: {}
    t.index ["ancestry"], name: "index_nodes_on_ancestry"
    t.index ["ancestry_depth"], name: "index_nodes_on_ancestry_depth"
    t.index ["excluded_locales"], name: "index_nodes_on_excluded_locales", using: :gin
    t.index ["is_allowlist"], name: "index_nodes_on_is_allowlist"
    t.index ["position"], name: "index_nodes_on_position"
    t.index ["settings"], name: "index_nodes_on_settings", using: :gin
    t.index ["slug"], name: "index_nodes_on_slug", using: :gin
    t.index ["status"], name: "index_nodes_on_status"
    t.index ["tags"], name: "index_nodes_on_tags", using: :gin
    t.index ["template"], name: "index_nodes_on_template"
    t.index ["url"], name: "index_nodes_on_url", using: :gin
  end

  create_table "players", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.boolean "is_done", default: false, null: false
    t.string "locale", null: false
    t.jsonb "progress", default: {}, null: false
    t.integer "score", default: 0, null: false
    t.jsonb "scores", default: {}, null: false
    t.datetime "updated_at", null: false
    t.index ["is_done"], name: "index_players_on_is_done"
    t.index ["locale"], name: "index_players_on_locale"
  end

  create_table "quiz_results", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.string "locale", null: false
    t.string "player_name", null: false
    t.integer "score", null: false
    t.string "share_id", null: false
    t.string "stats", null: false
    t.datetime "updated_at", null: false
    t.index ["share_id"], name: "index_quiz_results_on_share_id", unique: true
  end

  create_table "users", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.text "description"
    t.text "email"
    t.datetime "enabled_at"
    t.text "firstname"
    t.datetime "last_logon_at"
    t.text "lastname"
    t.text "password_digest"
    t.text "phone"
    t.enum "role", default: "user", enum_type: "user_roles"
    t.text "title"
    t.datetime "updated_at", null: false
    t.index ["email"], name: "index_users_on_email"
  end

  create_table "verification_codes", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.text "token"
    t.datetime "updated_at", null: false
    t.bigint "user_id"
    t.index ["token"], name: "index_verification_codes_on_token"
    t.index ["user_id"], name: "index_verification_codes_on_user_id"
  end

  add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
  add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
end
