|
|
# 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.0].define(version: 2025_05_27_114853) 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.string "name", null: false
|
|
|
t.string "record_type", null: false
|
|
|
t.bigint "record_id", null: false
|
|
|
t.bigint "blob_id", null: false
|
|
|
t.datetime "created_at", 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.string "key", null: false
|
|
|
t.string "filename", null: false
|
|
|
t.string "content_type"
|
|
|
t.text "metadata"
|
|
|
t.string "service_name", null: false
|
|
|
t.bigint "byte_size", null: false
|
|
|
t.string "checksum"
|
|
|
t.datetime "created_at", 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.bigint "player_id"
|
|
|
t.bigint "node_id"
|
|
|
t.integer "value"
|
|
|
t.datetime "created_at", null: false
|
|
|
t.datetime "updated_at", null: false
|
|
|
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.text "title"
|
|
|
t.datetime "created_at", null: false
|
|
|
t.datetime "updated_at", null: false
|
|
|
t.text "tags", default: [], array: true
|
|
|
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.jsonb "url", default: {}
|
|
|
t.jsonb "props", default: {}
|
|
|
t.boolean "is_favorite", default: false, null: false
|
|
|
t.integer "position"
|
|
|
t.datetime "created_at", null: false
|
|
|
t.datetime "updated_at", null: false
|
|
|
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.integer "position"
|
|
|
t.integer "status", default: 0
|
|
|
t.integer "template", default: 0
|
|
|
t.integer "ancestry_depth", default: 0
|
|
|
t.string "ancestry", null: false, collation: "C"
|
|
|
t.jsonb "slug", default: {}
|
|
|
t.jsonb "url", default: {}
|
|
|
t.jsonb "title", default: {}
|
|
|
t.jsonb "page_title", default: {}
|
|
|
t.jsonb "page_description", default: {}
|
|
|
t.jsonb "href", default: {}
|
|
|
t.jsonb "tags", default: {}
|
|
|
t.text "settings", default: [], array: true
|
|
|
t.text "excluded_locales", default: [], array: true
|
|
|
t.boolean "is_allowlist", default: false
|
|
|
t.datetime "published_at"
|
|
|
t.datetime "expires_at"
|
|
|
t.datetime "created_at", null: false
|
|
|
t.datetime "updated_at", null: false
|
|
|
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.text "name"
|
|
|
t.text "locale"
|
|
|
t.integer "answer_cache", default: [], array: true
|
|
|
t.datetime "created_at", null: false
|
|
|
t.datetime "updated_at", null: false
|
|
|
t.integer "score"
|
|
|
t.index ["answer_cache"], name: "index_players_on_answer_cache", using: :gin
|
|
|
t.index ["score"], name: "index_players_on_score"
|
|
|
end
|
|
|
|
|
|
create_table "quiz_results", force: :cascade do |t|
|
|
|
t.string "share_id", null: false
|
|
|
t.string "player_name", null: false
|
|
|
t.string "stats", null: false
|
|
|
t.string "locale", null: false
|
|
|
t.integer "score", null: false
|
|
|
t.datetime "created_at", 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.text "email"
|
|
|
t.text "password_digest"
|
|
|
t.text "firstname"
|
|
|
t.text "lastname"
|
|
|
t.text "title"
|
|
|
t.text "phone"
|
|
|
t.text "description"
|
|
|
t.enum "role", default: "user", enum_type: "user_roles"
|
|
|
t.datetime "enabled_at"
|
|
|
t.datetime "last_logon_at"
|
|
|
t.datetime "created_at", null: false
|
|
|
t.datetime "updated_at", null: false
|
|
|
t.index ["email"], name: "index_users_on_email"
|
|
|
end
|
|
|
|
|
|
create_table "verification_codes", force: :cascade do |t|
|
|
|
t.bigint "user_id"
|
|
|
t.text "token"
|
|
|
t.datetime "created_at", null: false
|
|
|
t.datetime "updated_at", null: false
|
|
|
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
|