diff --git a/db/schema.rb b/db/schema.rb --- a/db/schema.rb +++ b/db/schema.rb @@ -9,240 +9,275 @@ # 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). # -# It's strongly recommended to check this file into your version control system. +# It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150203153534) do +ActiveRecord::Schema.define(version: 20170427070345) do - create_table "announcements", :force => true do |t| - t.string "author" - t.text "body" + create_table "announcements", force: :cascade do |t| + t.string "author", limit: 255 + t.text "body", limit: 65535 t.boolean "published" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.boolean "frontpage", :default => false - t.boolean "contest_only", :default => false - t.string "title" - t.string "notes" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "frontpage", default: false + t.boolean "contest_only", default: false + t.string "title", limit: 255 + t.string "notes", limit: 255 end - create_table "contests", :force => true do |t| - t.string "title" + create_table "contests", force: :cascade do |t| + t.string "title", limit: 255 t.boolean "enabled" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.string "name" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "name", limit: 255 end - create_table "contests_problems", :id => false, :force => true do |t| - t.integer "contest_id" - t.integer "problem_id" + create_table "contests_problems", id: false, force: :cascade do |t| + t.integer "contest_id", limit: 4 + t.integer "problem_id", limit: 4 end - create_table "contests_users", :id => false, :force => true do |t| - t.integer "contest_id" - t.integer "user_id" + create_table "contests_users", id: false, force: :cascade do |t| + t.integer "contest_id", limit: 4 + t.integer "user_id", limit: 4 end - create_table "countries", :force => true do |t| - t.string "name" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + create_table "countries", force: :cascade do |t| + t.string "name", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "descriptions", :force => true do |t| - t.text "body" + create_table "descriptions", force: :cascade do |t| + t.text "body", limit: 65535 t.boolean "markdowned" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "grader_configurations", :force => true 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" + create_table "grader_configurations", force: :cascade do |t| + t.string "key", limit: 255 + t.string "value_type", limit: 255 + t.string "value", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.text "description", limit: 65535 end - create_table "grader_processes", :force => true do |t| - t.string "host", :limit => 20 - t.integer "pid" - t.string "mode" + create_table "grader_processes", force: :cascade do |t| + t.string "host", limit: 255 + t.integer "pid", limit: 4 + t.string "mode", limit: 255 t.boolean "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "task_id" - t.string "task_type" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "task_id", limit: 4 + t.string "task_type", limit: 255 t.boolean "terminated" end - add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid" + add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid", using: :btree - create_table "languages", :force => true do |t| - t.string "name", :limit => 10 - t.string "pretty_name" - t.string "ext", :limit => 10 - t.string "common_ext" + create_table "heart_beats", force: :cascade do |t| + t.integer "user_id", limit: 4 + t.string "ip_address", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "status", limit: 255 + end + + add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree + + create_table "languages", force: :cascade do |t| + t.string "name", limit: 10 + t.string "pretty_name", limit: 255 + t.string "ext", limit: 10 + t.string "common_ext", limit: 255 end - create_table "logins", :force => true do |t| - t.string "user_id" - t.string "ip_address" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + create_table "logins", force: :cascade do |t| + t.integer "user_id", limit: 4 + t.string "ip_address", limit: 255 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "messages", :force => true do |t| - t.integer "sender_id" - t.integer "receiver_id" - t.integer "replying_message_id" - t.text "body" + create_table "messages", force: :cascade do |t| + t.integer "sender_id", limit: 4 + t.integer "receiver_id", limit: 4 + t.integer "replying_message_id", limit: 4 + t.text "body", limit: 65535 t.boolean "replied" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "problems", :force => true do |t| - t.string "name", :limit => 30 - t.string "full_name" - t.integer "full_score" + create_table "problems", force: :cascade do |t| + t.string "name", limit: 30 + t.string "full_name", limit: 255 + t.integer "full_score", limit: 4 t.date "date_added" t.boolean "available" - t.string "url" - t.integer "description_id" + t.string "url", limit: 255 + t.integer "description_id", limit: 4 t.boolean "test_allowed" t.boolean "output_only" - t.string "description_filename" + t.string "description_filename", limit: 255 + t.boolean "view_testcase" end - create_table "rights", :force => true do |t| - t.string "name" - t.string "controller" - t.string "action" + create_table "rights", force: :cascade do |t| + t.string "name", limit: 255 + t.string "controller", limit: 255 + t.string "action", limit: 255 end - create_table "rights_roles", :id => false, :force => true do |t| - t.integer "right_id" - t.integer "role_id" + create_table "rights_roles", id: false, force: :cascade do |t| + t.integer "right_id", limit: 4 + t.integer "role_id", limit: 4 end - add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id" + add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree - create_table "roles", :force => true do |t| - t.string "name" + create_table "roles", force: :cascade do |t| + t.string "name", limit: 255 end - create_table "roles_users", :id => false, :force => true do |t| - t.integer "role_id" - t.integer "user_id" + create_table "roles_users", id: false, force: :cascade do |t| + t.integer "role_id", limit: 4 + t.integer "user_id", limit: 4 end - add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" + add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree - create_table "sessions", :force => true do |t| - t.string "session_id" - t.text "data" + create_table "sessions", force: :cascade do |t| + t.string "session_id", limit: 255 + t.text "data", limit: 65535 t.datetime "updated_at" end - add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" - add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" + add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree + add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree - create_table "sites", :force => true do |t| - t.string "name" + create_table "sites", force: :cascade do |t| + t.string "name", limit: 255 t.boolean "started" t.datetime "start_time" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "country_id" - t.string "password" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "country_id", limit: 4 + t.string "password", limit: 255 + end + + create_table "submission_view_logs", force: :cascade do |t| + t.integer "user_id", limit: 4 + t.integer "submission_id", limit: 4 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "submissions", :force => true do |t| - t.integer "user_id" - t.integer "problem_id" - t.integer "language_id" - t.text "source" - t.binary "binary" + create_table "submissions", force: :cascade do |t| + t.integer "user_id", limit: 4 + t.integer "problem_id", limit: 4 + t.integer "language_id", limit: 4 + t.text "source", limit: 65535 + t.binary "binary", limit: 65535 t.datetime "submitted_at" t.datetime "compiled_at" - t.text "compiler_message" + t.text "compiler_message", limit: 65535 t.datetime "graded_at" - t.integer "points" - 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 "points", limit: 4 + t.text "grader_comment", limit: 65535 + t.integer "number", limit: 4 + t.string "source_filename", limit: 255 + t.float "max_runtime", limit: 24 + t.integer "peak_memory", limit: 4 + t.integer "effective_code_length", limit: 4 + t.string "ip_address", limit: 255 end - add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true - add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id" + add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree + add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree - create_table "tasks", :force => true do |t| - t.integer "submission_id" + create_table "tasks", force: :cascade do |t| + t.integer "submission_id", limit: 4 t.datetime "created_at" - t.integer "status" + t.integer "status", limit: 4 t.datetime "updated_at" end - create_table "test_pairs", :force => true do |t| - t.integer "problem_id" - t.text "input", :limit => 16777215 - t.text "solution", :limit => 16777215 - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + add_index "tasks", ["submission_id"], name: "index_tasks_on_submission_id", using: :btree + + create_table "test_pairs", force: :cascade do |t| + t.integer "problem_id", limit: 4 + t.text "input", limit: 16777215 + t.text "solution", limit: 16777215 + t.datetime "created_at", null: false + t.datetime "updated_at", null: false end - create_table "test_requests", :force => true do |t| - t.integer "user_id" - t.integer "problem_id" - t.integer "submission_id" - t.string "input_file_name" - t.string "output_file_name" - t.string "running_stat" - t.integer "status" - t.datetime "updated_at", :null => false + create_table "test_requests", force: :cascade do |t| + t.integer "user_id", limit: 4 + t.integer "problem_id", limit: 4 + t.integer "submission_id", limit: 4 + t.string "input_file_name", limit: 255 + t.string "output_file_name", limit: 255 + t.string "running_stat", limit: 255 + t.integer "status", limit: 4 + t.datetime "updated_at", null: false t.datetime "submitted_at" t.datetime "compiled_at" - t.text "compiler_message" + t.text "compiler_message", limit: 65535 t.datetime "graded_at" - t.string "grader_comment" - t.datetime "created_at", :null => false - t.float "running_time" - t.string "exit_status" - t.integer "memory_usage" + t.string "grader_comment", limit: 255 + t.datetime "created_at", null: false + t.float "running_time", limit: 24 + t.string "exit_status", limit: 255 + t.integer "memory_usage", limit: 4 end - add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id" + add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree - create_table "user_contest_stats", :force => true do |t| - t.integer "user_id" + create_table "testcases", force: :cascade do |t| + t.integer "problem_id", limit: 4 + t.integer "num", limit: 4 + t.integer "group", limit: 4 + t.integer "score", limit: 4 + t.text "input", limit: 4294967295 + t.text "sol", limit: 4294967295 + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id", using: :btree + + create_table "user_contest_stats", force: :cascade do |t| + t.integer "user_id", limit: 4 t.datetime "started_at" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false t.boolean "forced_logout" end - create_table "users", :force => true do |t| - t.string "login", :limit => 50 - t.string "full_name" - t.string "hashed_password" - t.string "salt", :limit => 5 - t.string "alias" - t.string "email" - t.integer "site_id" - t.integer "country_id" - t.boolean "activated", :default => false + create_table "users", force: :cascade do |t| + t.string "login", limit: 50 + t.string "full_name", limit: 255 + t.string "hashed_password", limit: 255 + t.string "salt", limit: 5 + t.string "alias", limit: 255 + t.string "email", limit: 255 + t.integer "site_id", limit: 4 + t.integer "country_id", limit: 4 + t.boolean "activated", default: false t.datetime "created_at" t.datetime "updated_at" - t.boolean "enabled", :default => true - t.string "remark" + t.boolean "enabled", default: true + t.string "remark", limit: 255 + t.string "last_ip", limit: 255 + t.string "section", limit: 255 end - add_index "users", ["login"], :name => "index_users_on_login", :unique => true + add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree end