diff --git a/db/schema.rb b/db/schema.rb --- a/db/schema.rb +++ b/db/schema.rb @@ -2,19 +2,19 @@ # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). +# 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.define(version: 2021_08_09_105935) do +ActiveRecord::Schema.define(version: 2022_02_04_080936) do - create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "announcements", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "author" - t.text "body", limit: 16777215 + t.text "body" t.boolean "published" t.datetime "created_at", null: false t.datetime "updated_at", null: false @@ -25,7 +25,7 @@ t.boolean "on_nav_bar", default: false end - create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "contests", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "title" t.boolean "enabled" t.datetime "created_at", null: false @@ -33,39 +33,39 @@ t.string "name" end - create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "contests_problems", id: false, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "contest_id" t.integer "problem_id" end - create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "contests_users", id: false, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "contest_id" t.integer "user_id" end - create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "countries", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| - t.text "body", limit: 16777215 + create_table "descriptions", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| + t.text "body" t.boolean "markdowned" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "grader_configurations", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "key" t.string "value_type" t.string "value" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.text "description", limit: 16777215 + t.text "description" end - create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "grader_processes", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "host" t.integer "pid" t.string "mode" @@ -78,25 +78,25 @@ t.index ["host", "pid"], name: "index_grader_processes_on_ip_and_pid" end - create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "groups", id: :integer, charset: "latin1", force: :cascade do |t| t.string "name" t.string "description" t.boolean "enabled", default: true end - create_table "groups_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "groups_problems", id: false, charset: "latin1", force: :cascade do |t| t.integer "problem_id", null: false t.integer "group_id", null: false t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id" end - create_table "groups_users", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "groups_users", charset: "latin1", force: :cascade do |t| t.integer "group_id", null: false t.integer "user_id", null: false t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id" end - create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "heart_beats", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "user_id" t.string "ip_address" t.datetime "created_at", null: false @@ -105,14 +105,14 @@ t.index ["updated_at"], name: "index_heart_beats_on_updated_at" end - create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "languages", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "name", limit: 10 t.string "pretty_name" t.string "ext", limit: 10 t.string "common_ext" end - create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "logins", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "user_id" t.string "ip_address" t.datetime "created_at", null: false @@ -120,18 +120,18 @@ t.index ["user_id"], name: "index_logins_on_user_id" end - create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "messages", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "sender_id" t.integer "receiver_id" t.integer "replying_message_id" - t.text "body", limit: 16777215 + t.text "body" t.boolean "replied" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| - t.string "name", limit: 100 + create_table "problems", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| + t.string "name", limit: 30 t.string "full_name" t.integer "full_score" t.date "date_added" @@ -142,9 +142,10 @@ t.boolean "output_only" t.string "description_filename" t.boolean "view_testcase" + t.integer "difficulty" end - create_table "problems_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "problems_tags", id: :integer, charset: "latin1", force: :cascade do |t| t.integer "problem_id" t.integer "tag_id" t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true @@ -152,37 +153,37 @@ t.index ["tag_id"], name: "index_problems_tags_on_tag_id" end - create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "rights", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "name" t.string "controller" t.string "action" end - create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "rights_roles", id: false, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "right_id" t.integer "role_id" t.index ["role_id"], name: "index_rights_roles_on_role_id" end - create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "roles", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "name" end - create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "roles_users", id: false, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "role_id" t.integer "user_id" t.index ["user_id"], name: "index_roles_users_on_user_id" end - create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "sessions", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "session_id" - t.text "data", limit: 16777215 + t.text "data" t.datetime "updated_at" t.index ["session_id"], name: "index_sessions_on_session_id" t.index ["updated_at"], name: "index_sessions_on_updated_at" end - create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "sites", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "name" t.boolean "started" t.datetime "start_time" @@ -192,37 +193,38 @@ t.string "password" end - create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "submission_view_logs", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "user_id" t.integer "submission_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "submissions", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "user_id" t.integer "problem_id" t.integer "language_id" - t.text "source", limit: 16777215 + t.text "source", size: :medium t.binary "binary" t.datetime "submitted_at" t.datetime "compiled_at" - t.text "compiler_message", limit: 16777215 + t.text "compiler_message" t.datetime "graded_at" t.integer "points" - t.text "grader_comment", limit: 16777215 + t.text "grader_comment" t.integer "number" t.string "source_filename" t.float "max_runtime" t.integer "peak_memory" t.integer "effective_code_length" t.string "ip_address" + t.integer "tag", default: 0 t.index ["submitted_at"], name: "index_submissions_on_submitted_at" t.index ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true t.index ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id" end - create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "tags", id: :integer, charset: "latin1", force: :cascade do |t| t.string "name", null: false t.text "description" t.boolean "public" @@ -230,7 +232,7 @@ t.datetime "updated_at", null: false end - create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "tasks", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "submission_id" t.datetime "created_at" t.integer "status" @@ -239,15 +241,15 @@ t.index ["submission_id"], name: "index_tasks_on_submission_id" end - create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "test_pairs", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "problem_id" - t.text "input", limit: 4294967295 - t.text "solution", limit: 4294967295 + t.text "input", size: :medium + t.text "solution", size: :medium t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "test_requests", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "user_id" t.integer "problem_id" t.integer "submission_id" @@ -258,7 +260,7 @@ t.datetime "updated_at", null: false t.datetime "submitted_at" t.datetime "compiled_at" - t.text "compiler_message", limit: 16777215 + t.text "compiler_message" t.datetime "graded_at" t.string "grader_comment" t.datetime "created_at", null: false @@ -268,19 +270,19 @@ t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id" end - create_table "testcases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t| + create_table "testcases", id: :integer, charset: "latin1", force: :cascade do |t| t.integer "problem_id" t.integer "num" t.integer "group" t.integer "score" - t.text "input", limit: 4294967295 - t.text "sol", limit: 4294967295 - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.text "input", size: :long + t.text "sol", size: :long + t.datetime "created_at" + t.datetime "updated_at" t.index ["problem_id"], name: "index_testcases_on_problem_id" end - create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "user_contest_stats", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.integer "user_id" t.datetime "started_at" t.datetime "created_at", null: false @@ -288,7 +290,7 @@ t.boolean "forced_logout" end - create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + create_table "users", id: :integer, charset: "utf8", collation: "utf8_unicode_ci", force: :cascade do |t| t.string "login", limit: 50 t.string "full_name" t.string "hashed_password" @@ -300,10 +302,10 @@ t.boolean "activated", default: false t.datetime "created_at" t.datetime "updated_at" - t.string "section" t.boolean "enabled", default: true t.string "remark" t.string "last_ip" + t.string "section" t.integer "default_language" t.index ["login"], name: "index_users_on_login", unique: true end