# 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.
#
# 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).
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_06_09_012340) do

  create_table "activities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "act_id", null: false
    t.string "act_type", null: false
    t.integer "user_id", null: false
    t.integer "activity_container_id"
    t.string "activity_container_type", default: ""
    t.datetime "created_at"
    t.index ["act_id", "act_type"], name: "index_activities_on_act_id_and_act_type"
    t.index ["user_id", "act_type"], name: "index_activities_on_user_id_and_act_type"
    t.index ["user_id"], name: "index_activities_on_user_id"
  end

  create_table "activity_notifies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "activity_container_id"
    t.string "activity_container_type"
    t.integer "activity_id"
    t.string "activity_type"
    t.integer "notify_to"
    t.datetime "created_on"
    t.integer "is_read"
    t.index ["activity_container_id", "activity_container_type"], name: "index_an_activity_container_id"
    t.index ["created_on"], name: "index_an_created_on"
    t.index ["notify_to"], name: "index_an_notify_to"
  end

  create_table "api_keys", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "access_token"
    t.datetime "expires_at"
    t.integer "user_id"
    t.boolean "active", default: true
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["access_token"], name: "index_api_keys_on_access_token"
    t.index ["user_id"], name: "index_api_keys_on_user_id"
  end

  create_table "applied_contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "contest_id"
    t.integer "user_id"
    t.string "role"
    t.integer "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["contest_id"], name: "index_applied_contests_on_contest_id"
    t.index ["user_id"], name: "index_applied_contests_on_user_id"
  end

  create_table "applied_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "applied_id"
    t.string "applied_type"
    t.integer "viewed", default: 0
    t.integer "status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "name"
    t.integer "applied_user_id"
    t.integer "role"
    t.integer "project_id"
  end

  create_table "applied_projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id", null: false
    t.integer "user_id", null: false
    t.integer "role", default: 0
    t.integer "status", default: 0
  end

  create_table "apply_actions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "reason"
    t.integer "container_id"
    t.string "container_type"
    t.integer "dealer_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "status", limit: 1, default: 0
    t.text "apply_reason"
    t.boolean "noticed", default: false
    t.string "ip_addr"
    t.string "reject_description"
    t.index ["user_id"], name: "index_apply_actions_on_user_id"
  end

  create_table "apply_add_departments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "department_id"
    t.integer "school_id"
    t.text "remarks"
    t.integer "user_id"
    t.integer "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["department_id"], name: "index_apply_add_departments_on_department_id"
    t.index ["school_id"], name: "index_apply_add_departments_on_school_id"
    t.index ["user_id"], name: "index_apply_add_departments_on_user_id"
  end

  create_table "apply_add_schools", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "province"
    t.string "city"
    t.string "address"
    t.string "remarks"
    t.integer "school_id"
    t.integer "status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "user_id"
  end

  create_table "apply_homeworks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "status"
    t.integer "user_id"
    t.integer "homework_common_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["homework_common_id"], name: "index_apply_homeworks_on_homework_common_id"
    t.index ["user_id"], name: "index_apply_homeworks_on_user_id"
  end

  create_table "apply_jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "job_id"
    t.datetime "viewed_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["job_id"], name: "index_apply_jobs_on_job_id"
    t.index ["user_id"], name: "index_apply_jobs_on_user_id"
  end

  create_table "apply_project_masters", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "apply_type"
    t.integer "apply_id"
    t.integer "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "apply_resources", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "status"
    t.integer "user_id"
    t.integer "attachment_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "container_id"
    t.string "container_type"
    t.text "content"
    t.integer "apply_user_id"
  end

  create_table "apply_user_authentications", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "status"
    t.integer "auth_type"
    t.string "remarks"
    t.integer "dealer"
    t.datetime "deal_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "is_delete", default: false
    t.index ["user_id"], name: "index_apply_user_authentications_on_user_id"
  end

  create_table "article_homepages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "title"
    t.text "content"
    t.integer "user_id"
    t.integer "homepage_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["homepage_id"], name: "index_article_homepages_on_homepage_id"
    t.index ["user_id"], name: "index_article_homepages_on_user_id"
  end

  create_table "at_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "at_message_id"
    t.string "at_message_type"
    t.boolean "viewed", default: false
    t.string "container_type"
    t.integer "container_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "sender_id"
    t.index ["user_id"], name: "index_at_messages_on_user_id"
  end

  create_table "attachment_group_settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "attachment_id"
    t.integer "course_group_id"
    t.integer "course_id"
    t.datetime "publish_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["attachment_id"], name: "index_attachment_group_settings_on_attachment_id"
    t.index ["course_group_id"], name: "index_attachment_group_settings_on_course_group_id"
    t.index ["course_id"], name: "index_attachment_group_settings_on_course_id"
  end

  create_table "attachment_histories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "container_id"
    t.string "container_type"
    t.string "filename", default: ""
    t.string "disk_filename", default: ""
    t.integer "filesize", default: 0
    t.string "content_type", default: ""
    t.string "digest", limit: 60, default: ""
    t.integer "downloads", default: 0
    t.integer "author_id"
    t.datetime "created_on"
    t.text "description"
    t.string "disk_directory"
    t.integer "attachtype"
    t.integer "is_public"
    t.integer "copy_from"
    t.integer "quotes"
    t.integer "version"
    t.integer "attachment_id"
    t.integer "is_publish", default: 1
    t.date "publish_time"
    t.string "cloud_url", default: ""
  end

  create_table "attachments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "container_id"
    t.string "container_type", limit: 30
    t.string "filename", default: "", null: false
    t.string "disk_filename", default: "", null: false
    t.integer "filesize", default: 0, null: false
    t.string "content_type", default: ""
    t.string "digest", limit: 60, default: "", null: false
    t.integer "downloads", default: 0, null: false
    t.integer "author_id", default: 0, null: false
    t.datetime "created_on"
    t.text "description"
    t.string "disk_directory"
    t.integer "attachtype", default: 1
    t.integer "is_public", default: 1
    t.string "copy_from"
    t.integer "quotes", default: 0
    t.integer "is_publish", default: 1
    t.datetime "publish_time"
    t.integer "resource_bank_id"
    t.boolean "unified_setting", default: true
    t.string "cloud_url", default: ""
    t.integer "course_second_category_id", default: 0
    t.boolean "delay_publish", default: false
    t.string "link"
    t.index ["author_id"], name: "index_attachments_on_author_id"
    t.index ["container_id", "container_type"], name: "index_attachments_on_container_id_and_container_type"
    t.index ["created_on"], name: "index_attachments_on_created_on"
  end

  create_table "attachmentstypes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "typeId", null: false
    t.string "typeName", limit: 50
  end

  create_table "attendances", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "score", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "user"
  end

  create_table "auth_sources", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "type", limit: 30, default: "", null: false
    t.string "name", limit: 60, default: "", null: false
    t.string "host", limit: 60
    t.integer "port"
    t.string "account"
    t.string "account_password", default: ""
    t.string "base_dn"
    t.string "attr_login", limit: 30
    t.string "attr_firstname", limit: 30
    t.string "attr_lastname", limit: 30
    t.string "attr_mail", limit: 30
    t.boolean "onthefly_register", default: false, null: false
    t.boolean "tls", default: false, null: false
    t.string "filter"
    t.integer "timeout"
    t.index ["id", "type"], name: "index_auth_sources_on_id_and_type"
  end

  create_table "authentications", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "level", limit: 1
    t.text "permissions"
  end

  create_table "authentications_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "authentication_id"
  end

  create_table "bidding_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_package_id"
    t.integer "user_id"
    t.string "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["project_package_id"], name: "index_bidding_users_on_project_package_id"
    t.index ["user_id"], name: "index_bidding_users_on_user_id"
  end

  create_table "biding_projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.integer "bid_id"
    t.integer "user_id"
    t.string "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "reward"
  end

  create_table "bids", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "budget", null: false
    t.integer "author_id"
    t.date "deadline"
    t.text "description"
    t.datetime "created_on", null: false
    t.datetime "updated_on", null: false
    t.integer "commit"
    t.integer "reward_type"
    t.integer "homework_type"
    t.integer "parent_id"
    t.string "password"
    t.integer "is_evaluation"
    t.integer "proportion", default: 60
    t.integer "comment_status", default: 0
    t.integer "evaluation_num", default: 3
    t.integer "open_anonymous_evaluation", default: 1
  end

  create_table "blog_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "blog_id", null: false
    t.integer "parent_id"
    t.string "title", default: "", null: false
    t.text "content"
    t.integer "author_id"
    t.integer "comments_count", default: 0, null: false
    t.integer "last_comment_id"
    t.datetime "created_on", null: false
    t.datetime "updated_on", null: false
    t.boolean "locked", default: false
    t.integer "sticky", default: 0
    t.integer "reply_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "root_id"
    t.integer "visits", default: 0
    t.index ["root_id"], name: "index_blog_comments_on_root_id"
  end

  create_table "blog_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "blog_message_id"
    t.integer "blog_id"
    t.string "blog_message_type"
    t.boolean "viewed", default: false
    t.text "content"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "user_operator_id"
  end

  create_table "blogs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", default: "", null: false
    t.text "description"
    t.integer "position", default: 1
    t.integer "article_count", default: 0, null: false
    t.integer "comments_count", default: 0, null: false
    t.integer "last_comments_id"
    t.integer "parent_id"
    t.integer "author_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "homepage_id"
  end

  create_table "boards", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id", null: false
    t.string "name", default: "", null: false
    t.string "description"
    t.integer "position", default: 1
    t.integer "topics_count", default: 0, null: false
    t.integer "messages_count", default: 0, null: false
    t.integer "last_message_id"
    t.integer "parent_id", default: 0
    t.integer "course_id"
    t.integer "org_subfield_id"
    t.integer "contest_id"
    t.index ["course_id"], name: "index_boards_on_course_id"
    t.index ["last_message_id"], name: "index_boards_on_last_message_id"
    t.index ["parent_id"], name: "parent"
    t.index ["project_id"], name: "boards_project_id"
  end

  create_table "bug_to_osps", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "osp_id"
    t.integer "relative_memo_id"
    t.string "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "career_faqs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "question"
    t.string "answer"
    t.integer "career_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "career_stage_subjects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "career_stage_id"
    t.integer "subject_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "career_stages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "description"
    t.string "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "career_id"
  end

  create_table "careers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "video_name"
    t.string "video_description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "user_id"
    t.boolean "status", default: false
    t.datetime "published_at"
  end

  create_table "challenge_answers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "contents", limit: 4294967295
    t.integer "score"
    t.integer "level"
    t.bigint "challenge_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["challenge_id"], name: "index_challenge_answers_on_challenge_id"
  end

  create_table "challenge_chooses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "subject"
    t.integer "challenge_id"
    t.string "standard_answer"
    t.text "answer"
    t.integer "score"
    t.integer "difficult", default: 1
    t.integer "category"
    t.integer "position", default: 1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["challenge_id"], name: "index_challenge_chooses_on_challenge_id"
  end

  create_table "challenge_questions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "option_name"
    t.integer "challenge_choose_id"
    t.boolean "right_key"
    t.integer "position", limit: 1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["challenge_choose_id"], name: "index_challenge_questions_on_challenge_choose_id"
  end

  create_table "challenge_samples", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "input"
    t.string "output"
    t.integer "challenge_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "game_id"
  end

  create_table "challenge_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "challenge_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "challenge_choose_id"
    t.index ["challenge_id"], name: "index_challenge_tags_on_challenge_id"
  end

  create_table "challenge_work_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "student_work_id"
    t.integer "challenge_id"
    t.float "score"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "comment"
    t.index ["challenge_id"], name: "index_challenge_work_scores_on_challenge_id"
    t.index ["student_work_id", "challenge_id"], name: "index_score_on_student_work_id_and_challenge_id"
    t.index ["student_work_id"], name: "index_challenge_work_scores_on_student_work_id"
  end

  create_table "challenges", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.string "subject"
    t.integer "user_id"
    t.integer "status", limit: 1, default: 0
    t.integer "position", limit: 1, default: 1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "task_pass", collation: "utf8mb4_unicode_ci"
    t.text "answer", limit: 4294967295
    t.integer "score", default: 100
    t.integer "visits", default: 0
    t.text "path"
    t.integer "evaluation_way", default: 0
    t.integer "difficulty", default: 1
    t.string "exec_path"
    t.integer "code_line"
    t.integer "st", limit: 1, default: 0
    t.text "web_route"
    t.text "picture_path"
    t.text "expect_picture_path"
    t.datetime "modify_time"
    t.integer "challenge_tags_count", default: 0
    t.string "original_picture_path"
    t.integer "show_type", default: -1
    t.boolean "test_set_score", default: false
    t.integer "exec_time", default: 20
    t.boolean "test_set_average", default: true
    t.integer "praises_count", default: 0
    t.boolean "ignore_space", default: true
    t.index ["shixun_id"], name: "index_challenges_on_shixun_id"
  end

  create_table "changes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "changeset_id", null: false
    t.string "action", limit: 1, default: "", null: false
    t.text "path", null: false
    t.text "from_path"
    t.string "from_revision"
    t.string "revision"
    t.string "branch"
    t.index ["changeset_id"], name: "changesets_changeset_id"
  end

  create_table "changeset_parents", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "changeset_id", null: false
    t.integer "parent_id", null: false
    t.index ["changeset_id"], name: "changeset_parents_changeset_ids"
    t.index ["parent_id"], name: "changeset_parents_parent_ids"
  end

  create_table "changesets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "repository_id", null: false
    t.string "revision", null: false
    t.string "committer"
    t.datetime "committed_on", null: false
    t.text "comments"
    t.date "commit_date"
    t.string "scmid"
    t.integer "user_id"
    t.integer "project_id"
    t.integer "type", default: 0
    t.index ["committed_on"], name: "index_changesets_on_committed_on"
    t.index ["repository_id", "revision"], name: "changesets_repos_rev", unique: true
    t.index ["repository_id", "scmid"], name: "changesets_repos_scmid"
    t.index ["repository_id"], name: "index_changesets_on_repository_id"
    t.index ["user_id"], name: "index_changesets_on_user_id"
  end

  create_table "changesets_issues", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "changeset_id", null: false
    t.integer "issue_id", null: false
    t.index ["changeset_id", "issue_id"], name: "changesets_issues_ids", unique: true
  end

  create_table "chart_rules", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "rule_type"
    t.text "content"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "competition_id"
    t.integer "competition_stage_id"
    t.index ["competition_id"], name: "index_chart_rules_on_competition_id"
    t.index ["competition_stage_id"], name: "index_chart_rules_on_competition_stage_id"
  end

  create_table "choose_outputs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "challenge_choose_id"
    t.integer "user_id"
    t.string "answer"
    t.boolean "correct"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "code_review_assignments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "issue_id"
    t.integer "change_id"
    t.integer "attachment_id"
    t.string "file_path"
    t.string "rev"
    t.string "rev_to"
    t.string "action_type"
    t.integer "changeset_id"
  end

  create_table "code_review_project_settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.integer "tracker_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer "updated_by"
    t.boolean "hide_code_review_tab", default: false
    t.integer "auto_relation", default: 1
    t.integer "assignment_tracker_id"
    t.text "auto_assign"
    t.integer "lock_version", default: 0, null: false
    t.boolean "tracker_in_review_dialog", default: false
  end

  create_table "code_review_user_settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", default: 0, null: false
    t.integer "mail_notification", default: 0, null: false
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "code_reviews", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.integer "change_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer "line"
    t.integer "updated_by_id"
    t.integer "lock_version", default: 0, null: false
    t.integer "status_changed_from"
    t.integer "status_changed_to"
    t.integer "issue_id"
    t.string "action_type"
    t.string "file_path"
    t.string "rev"
    t.string "rev_to"
    t.integer "attachment_id"
    t.integer "file_count", default: 0, null: false
    t.boolean "diff_all"
  end

  create_table "code_tests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "homework_id"
    t.integer "wait_time", default: 0
    t.integer "language"
    t.integer "status"
    t.integer "time_used", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "student_work_id", default: 0
  end

  create_table "collections", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.integer "container_id"
    t.string "container_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["container_type", "container_id"], name: "index_collections_on_container_type_and_container_id"
    t.index ["user_id", "container_type", "container_id"], name: "index_collections_on_user_id_and_container_type_and_container_id", unique: true
    t.index ["user_id"], name: "index_collections_on_user_id"
  end

  create_table "comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "commented_type", limit: 30, default: "", null: false
    t.integer "commented_id", default: 0, null: false
    t.integer "author_id", default: 0, null: false
    t.text "comments"
    t.datetime "created_on", null: false
    t.datetime "updated_on", null: false
    t.integer "parent_id"
    t.integer "comments_count", default: 0
    t.integer "reply_id"
    t.index ["author_id"], name: "index_comments_on_author_id"
    t.index ["commented_id", "commented_type"], name: "index_comments_on_commented_id_and_commented_type"
  end

  create_table "commit_issues", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "commit_id"
    t.integer "issue_id"
    t.integer "project_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "commits", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "repository_id"
    t.string "version"
    t.string "committer"
    t.text "comments"
    t.datetime "committed_on"
    t.integer "project_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "competition_awards", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "competition_id"
    t.string "name"
    t.integer "num", default: 0
    t.integer "award_type", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["competition_id"], name: "index_competition_awards_on_competition_id"
  end

  create_table "competition_course_records", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "competition_id"
    t.integer "competition_team_id"
    t.string "type"
    t.integer "user_id"
    t.string "username"
    t.integer "score"
    t.text "snapshot"
  end

  create_table "competition_entries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "competition_stage_section_id"
    t.integer "competition_stage_id"
    t.string "name"
    t.string "url"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "shixun_identifier"
    t.index ["competition_stage_id"], name: "index_competition_entries_on_competition_stage_id"
    t.index ["competition_stage_section_id"], name: "index_competition_entries_on_competition_stage_section_id"
  end

  create_table "competition_lists", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "competition_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["competition_id"], name: "index_competition_lists_on_competition_id"
  end

  create_table "competition_managers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "competition_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["competition_id"], name: "index_competition_managers_on_competition_id"
    t.index ["user_id"], name: "index_competition_managers_on_user_id"
  end

  create_table "competition_mode_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_id"
    t.datetime "start_time"
    t.datetime "end_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "competition_id"
    t.index ["competition_id"], name: "index_competition_mode_settings_on_competition_id"
    t.index ["course_id"], name: "index_competition_mode_settings_on_course_id"
  end

  create_table "competition_module_md_contents", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "content"
    t.integer "competition_module_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "competition_stage_id", default: 0
  end

  create_table "competition_modules", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "competition_id"
    t.string "name"
    t.boolean "hidden", default: false
    t.string "url"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "position", default: 0
    t.boolean "md_edit", default: false
    t.string "module_type"
    t.index ["competition_id"], name: "index_competition_modules_on_competition_id"
  end

  create_table "competition_prize_users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "competition_id"
    t.bigint "competition_team_id"
    t.bigint "competition_prize_id"
    t.bigint "user_id"
    t.bigint "approver_id"
    t.string "status"
    t.integer "rank"
    t.boolean "leader", default: false
    t.text "extra"
    t.datetime "approved_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["approver_id"], name: "index_competition_prize_users_on_approver_id"
    t.index ["competition_id"], name: "index_competition_prize_users_on_competition_id"
    t.index ["competition_prize_id"], name: "index_competition_prize_users_on_competition_prize_id"
    t.index ["competition_team_id"], name: "index_competition_prize_users_on_competition_team_id"
    t.index ["user_id"], name: "index_competition_prize_users_on_user_id"
  end

  create_table "competition_prizes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "competition_id"
    t.string "name"
    t.string "category"
    t.integer "num"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["competition_id"], name: "index_competition_prizes_on_competition_id"
  end

  create_table "competition_schools", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "competition_id"
    t.bigint "school_id"
    t.string "source"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["competition_id"], name: "index_competition_schools_on_competition_id"
    t.index ["school_id"], name: "index_competition_schools_on_school_id"
  end

  create_table "competition_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.float "score"
    t.string "score_type"
    t.string "region"
    t.integer "cost_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "competition_id"
    t.integer "competition_stage_id", default: 0
    t.integer "competition_team_id"
    t.index ["competition_id"], name: "index_competition_scores_on_competition_id"
    t.index ["competition_stage_id"], name: "index_competition_scores_on_competition_stage_id"
    t.index ["competition_team_id"], name: "index_competition_scores_on_competition_team_id"
    t.index ["user_id"], name: "index_competition_scores_on_user_id"
  end

  create_table "competition_staffs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "competition_id"
    t.integer "position"
    t.string "category"
    t.integer "minimum"
    t.integer "maximum"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "mutiple_limited", default: false
  end

  create_table "competition_stage_sections", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "competition_id"
    t.integer "competition_stage_id"
    t.string "name"
    t.datetime "start_time"
    t.datetime "end_time"
    t.integer "entry"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "mission_count", default: 0
    t.integer "score_source", default: 0
    t.index ["competition_id"], name: "index_competition_stage_sections_on_competition_id"
    t.index ["competition_stage_id"], name: "index_competition_stage_sections_on_competition_stage_id"
  end

  create_table "competition_stages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "competition_id"
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "score_rate", default: 1.0
    t.index ["competition_id"], name: "index_competition_stages_on_competition_id"
  end

  create_table "competition_teams", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "user_id"
    t.integer "competition_id"
    t.integer "team_type", default: 0
    t.string "invite_code"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "teacher_id"
    t.index ["competition_id"], name: "index_competition_teams_on_competition_id"
    t.index ["user_id"], name: "index_competition_teams_on_user_id"
  end

  create_table "competition_text_configs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "competition_id"
    t.string "name"
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "competitions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "start_time"
    t.datetime "end_time"
    t.string "identifier"
    t.boolean "status", default: false
    t.datetime "online_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "visits", default: 0
    t.integer "competition_lists_count", default: 0
    t.integer "min_num", default: 1
    t.integer "max_num", default: 1
    t.datetime "enroll_end_time"
    t.string "sub_title"
    t.datetime "published_at"
    t.integer "bonus", default: 0
    t.integer "mode", default: 1
    t.text "description"
    t.text "introduction"
    t.integer "awards_count", default: 0
    t.bigint "laboratory_id"
    t.index ["laboratory_id"], name: "index_competitions_on_laboratory_id"
  end

  create_table "contest_activities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "contest_id"
    t.integer "contest_act_id"
    t.string "contest_act_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["contest_id"], name: "index_contest_activities_on_contest_id"
    t.index ["user_id"], name: "index_contest_activities_on_user_id"
  end

  create_table "contest_member_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "contest_member_id"
    t.integer "role_id"
    t.boolean "is_current", default: true
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["contest_member_id"], name: "index_contest_member_roles_on_contest_member_id"
    t.index ["role_id"], name: "index_contest_member_roles_on_role_id"
  end

  create_table "contest_members", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "contest_id"
    t.boolean "is_collect", default: true
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["contest_id"], name: "index_contest_members_on_contest_id"
    t.index ["user_id"], name: "index_contest_members_on_user_id"
  end

  create_table "contest_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "contest_id"
    t.integer "contest_message_id"
    t.string "contest_message_type"
    t.boolean "viewed", default: false
    t.text "content"
    t.integer "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["contest_id"], name: "index_contest_messages_on_contest_id"
    t.index ["user_id"], name: "index_contest_messages_on_user_id"
  end

  create_table "contestant_for_contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "student_id"
    t.integer "contest_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["contest_id"], name: "index_contestant_for_contests_on_contest_id"
    t.index ["student_id"], name: "index_contestant_for_contests_on_student_id"
  end

  create_table "contestant_work_evaluation_distributions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "contestant_work_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_contestant_work_evaluation_distributions_on_user_id"
  end

  create_table "contestant_work_projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "contest_id"
    t.integer "work_id"
    t.integer "contestant_work_id"
    t.integer "project_id"
    t.integer "user_id"
    t.boolean "is_leader"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["contest_id"], name: "index_contestant_work_projects_on_contest_id"
    t.index ["contestant_work_id"], name: "index_contestant_work_projects_on_contestant_work_id"
    t.index ["user_id"], name: "index_contestant_work_projects_on_user_id"
    t.index ["work_id"], name: "index_contestant_work_projects_on_work_id"
  end

  create_table "contestant_work_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "contestant_work_id"
    t.integer "user_id"
    t.integer "score"
    t.text "comment"
    t.integer "reviewer_role"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["contestant_work_id"], name: "index_contestant_work_scores_on_contestant_work_id"
    t.index ["user_id"], name: "index_contestant_work_scores_on_user_id"
  end

  create_table "contestant_works", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "work_id"
    t.integer "user_id"
    t.float "work_score"
    t.integer "project_id"
    t.integer "work_status"
    t.datetime "commit_time"
    t.boolean "is_delete", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "judge_score"
    t.index ["project_id"], name: "index_contestant_works_on_project_id"
    t.index ["user_id"], name: "index_contestant_works_on_user_id"
    t.index ["work_id"], name: "index_contestant_works_on_work_id"
  end

  create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "name"
    t.text "description"
    t.boolean "is_public"
    t.boolean "is_delete", default: false
    t.integer "visits", default: 0
    t.string "invite_code"
    t.integer "invite_code_halt", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "coo_imgs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "src_states"
    t.string "url_states"
    t.string "img_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "position"
  end

  create_table "coop_imgs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "src_states"
    t.string "url_states"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "img_type"
  end

  create_table "cooperations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "mail"
    t.string "qq"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "user_type"
  end

  create_table "course_activities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "course_id"
    t.integer "course_act_id"
    t.string "course_act_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_id", "course_act_id", "course_act_type", "created_at"], name: "course_act_index"
  end

  create_table "course_attachments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "filename"
    t.string "disk_filename"
    t.integer "filesize"
    t.string "content_type"
    t.string "digest"
    t.integer "downloads"
    t.string "author_id"
    t.string "integer"
    t.string "description"
    t.string "disk_directory"
    t.integer "attachtype"
    t.integer "is_public"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "container_id", default: 0
  end

  create_table "course_attendance_groups", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_id"
    t.bigint "course_attendance_id"
    t.bigint "course_group_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_attendance_id", "course_group_id", "course_id"], name: "course_group_attendance", unique: true
    t.index ["course_attendance_id"], name: "index_course_attendance_groups_on_course_attendance_id"
    t.index ["course_group_id"], name: "index_course_attendance_groups_on_course_group_id"
    t.index ["course_id"], name: "index_course_attendance_groups_on_course_id"
  end

  create_table "course_attendances", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_id"
    t.bigint "user_id"
    t.string "name"
    t.integer "mode", limit: 1, default: 0
    t.date "attendance_date"
    t.time "start_time"
    t.time "end_time"
    t.string "attendance_code"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_id"], name: "index_course_attendances_on_course_id"
    t.index ["user_id"], name: "index_course_attendances_on_user_id"
  end

  create_table "course_contributor_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_id"
    t.integer "user_id"
    t.integer "message_num", default: 0
    t.integer "message_reply_num", default: 0
    t.integer "news_reply_num", default: 0
    t.integer "resource_num", default: 0
    t.integer "journal_num", default: 0
    t.integer "journal_reply_num", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "total_score", default: 0
    t.integer "homework_journal_num", default: 0
    t.integer "news_num", default: 0
    t.index ["course_id", "user_id"], name: "index_course_contributor_scores_on_course_id_and_user_id"
  end

  create_table "course_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "course_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "members_count"
    t.string "invite_code"
    t.integer "position", default: 0
    t.integer "course_members_count", default: 0
    t.boolean "invite_code_halt", default: false
    t.index ["course_id"], name: "index_course_groups_on_course_id"
    t.index ["invite_code"], name: "index_course_groups_on_invite_code", unique: true
  end

  create_table "course_homework_categories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_id"
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_id"], name: "index_course_homework_categories_on_course_id"
  end

  create_table "course_homework_statistics", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "course_id"
    t.integer "committed_work_num", default: 0
    t.integer "un_commit_work_num", default: 0
    t.integer "late_commit_work_num", default: 0
    t.integer "absence_evaluation_work_num", default: 0
    t.integer "un_evaluation_work_num", default: 0
    t.integer "appeal_num", default: 0
    t.float "average_score", default: 0.0
    t.float "total_score", default: 0.0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "course_infos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "course_lists", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer "user_id"
    t.boolean "is_admin", default: true
    t.boolean "support_shixuns_search", default: false
  end

  create_table "course_member_attendances", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_member_id"
    t.bigint "user_id"
    t.bigint "course_id"
    t.bigint "course_attendance_id"
    t.bigint "course_group_id"
    t.integer "attendance_mode", default: 0
    t.integer "attendance_status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_attendance_id", "user_id"], name: "index_on_user_attendance", unique: true
    t.index ["course_attendance_id"], name: "index_course_member_attendances_on_course_attendance_id"
    t.index ["course_group_id"], name: "index_course_member_attendances_on_course_group_id"
    t.index ["course_id"], name: "index_course_member_attendances_on_course_id"
    t.index ["course_member_id"], name: "index_course_member_attendances_on_course_member_id"
    t.index ["user_id"], name: "index_course_member_attendances_on_user_id"
  end

  create_table "course_members", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_id"
    t.integer "user_id"
    t.integer "course_group_id", default: 0
    t.integer "graduation_group_id", default: 0
    t.integer "role", default: 0
    t.boolean "is_active", default: true
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "sticky", default: false
    t.datetime "sticky_time"
    t.index ["course_group_id"], name: "index_course_members_on_course_group_id"
    t.index ["course_id", "user_id", "role"], name: "index_course_id_user_id_role", unique: true
  end

  create_table "course_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "course_id"
    t.integer "course_message_id"
    t.string "course_message_type"
    t.integer "viewed"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "content"
    t.integer "status"
    t.integer "apply_user_id"
    t.integer "apply_result"
    t.index ["course_message_type"], name: "index_course_messages_on_course_message_type"
    t.index ["user_id", "course_id", "created_at"], name: "index_course_messages_on_user_id_and_course_id_and_created_at"
  end

  create_table "course_modules", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_id"
    t.string "module_type"
    t.integer "position"
    t.integer "hidden"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "module_name"
    t.index ["course_id", "module_type"], name: "index_course_modules_on_course_id_and_module_type"
  end

  create_table "course_second_categories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_id"
    t.string "category_type"
    t.string "name"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "course_module_id"
    t.integer "parent_id", default: 0
    t.integer "user_id"
    t.index ["course_id"], name: "index_course_second_categories_on_course_id"
    t.index ["course_module_id"], name: "index_course_second_categories_on_course_module_id"
    t.index ["parent_id"], name: "index_course_second_categories_on_parent_id"
  end

  create_table "course_stage_shixuns", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_id"
    t.bigint "course_stage_id"
    t.bigint "shixun_id"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_id"], name: "index_course_stage_shixuns_on_course_id"
    t.index ["course_stage_id"], name: "index_course_stage_shixuns_on_course_stage_id"
    t.index ["shixun_id"], name: "index_course_stage_shixuns_on_shixun_id"
  end

  create_table "course_stages", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_id"
    t.string "name"
    t.text "description"
    t.integer "position"
    t.integer "shixuns_count"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_id"], name: "index_course_stages_on_course_id"
  end

  create_table "course_statuses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "changesets_count"
    t.integer "watchers_count"
    t.integer "course_id"
    t.float "grade", default: 0.0
    t.integer "course_ac_para", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "course_videos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_id"
    t.bigint "video_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "course_second_category_id", default: 0
    t.boolean "is_link", default: false
    t.string "title"
    t.string "link"
    t.integer "user_id"
    t.index ["course_id"], name: "index_course_videos_on_course_id"
    t.index ["video_id"], name: "index_course_videos_on_video_id"
  end

  create_table "courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "tea_id"
    t.string "name"
    t.integer "state"
    t.string "code"
    t.integer "time"
    t.string "extra"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "location"
    t.string "term"
    t.string "string"
    t.string "password"
    t.string "setup_time"
    t.string "endup_time"
    t.integer "class_period", default: 0
    t.integer "school_id"
    t.text "description"
    t.integer "status", default: 1
    t.integer "attachmenttype", default: 2
    t.integer "lft"
    t.integer "rgt"
    t.integer "is_public", limit: 1, default: 1
    t.integer "inherit_members", limit: 1, default: 1
    t.integer "open_student", default: 0
    t.integer "outline", default: 0
    t.integer "publish_resource", default: 0
    t.integer "is_delete", default: 0
    t.integer "end_time"
    t.string "end_term"
    t.integer "is_excellent", default: 0
    t.integer "excellent_option", default: 0
    t.integer "is_copy", default: 0
    t.integer "visits", default: 0
    t.integer "syllabus_id"
    t.string "invite_code"
    t.string "qrcode"
    t.integer "qrcode_expiretime", default: 0
    t.integer "invite_code_halt", limit: 1, default: 0
    t.integer "os_allow", default: 0
    t.float "credit"
    t.boolean "is_end", default: false
    t.date "end_date"
    t.boolean "choose_group_allow", default: false
    t.boolean "homepage_show", default: false
    t.integer "course_list_id"
    t.integer "members_count", default: 0
    t.integer "homework_commons_count", default: 0
    t.boolean "show_unit", default: false
    t.string "teacher_list", default: "老师"
    t.string "student_list", default: "学生"
    t.boolean "is_hidden", default: false
    t.integer "course_members_count", default: 0
    t.integer "course_groups_count", default: 0
    t.boolean "authentication", default: false
    t.boolean "professional_certification", default: false
    t.integer "graduation_topics_count", default: 0
    t.integer "graduation_tasks_count", default: 0
    t.integer "polls_count", default: 0
    t.integer "exercises_count", default: 0
    t.date "start_date"
    t.integer "subject_id", default: 0
    t.boolean "excellent", default: false
    t.boolean "email_notify", default: false
    t.boolean "sticky", default: false
    t.datetime "sticky_time"
    t.bigint "laboratory_id"
    t.index ["invite_code"], name: "index_courses_on_invite_code", unique: true
    t.index ["laboratory_id"], name: "index_courses_on_laboratory_id"
    t.index ["school_id", "is_delete"], name: "index_courses_on_school_id_and_is_delete"
    t.index ["subject_id"], name: "index_courses_on_subject_id"
    t.index ["tea_id"], name: "index_courses_on_tea_id"
  end

  create_table "curriculum_directions", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "curriculums", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "custom_fields", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "type", limit: 30, default: "", null: false
    t.string "name", limit: 30, default: "", null: false
    t.string "field_format", limit: 30, default: "", null: false
    t.text "possible_values"
    t.string "regexp", default: ""
    t.integer "min_length", default: 0, null: false
    t.integer "max_length", default: 0, null: false
    t.boolean "is_required", default: false, null: false
    t.boolean "is_for_all", default: false, null: false
    t.boolean "is_filter", default: false, null: false
    t.integer "position", default: 1
    t.boolean "searchable", default: false
    t.text "default_value"
    t.boolean "editable", default: true
    t.boolean "visible", default: true, null: false
    t.boolean "multiple", default: false
    t.index ["id", "type"], name: "index_custom_fields_on_id_and_type"
  end

  create_table "custom_fields_projects", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "custom_field_id", default: 0, null: false
    t.integer "project_id", default: 0, null: false
    t.index ["custom_field_id", "project_id"], name: "index_custom_fields_projects_on_custom_field_id_and_project_id", unique: true
  end

  create_table "custom_fields_trackers", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "custom_field_id", default: 0, null: false
    t.integer "tracker_id", default: 0, null: false
    t.index ["custom_field_id", "tracker_id"], name: "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", unique: true
  end

  create_table "custom_values", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "customized_type", limit: 30, default: "", null: false
    t.integer "customized_id", default: 0, null: false
    t.integer "custom_field_id", default: 0, null: false
    t.text "value"
    t.index ["custom_field_id"], name: "index_custom_values_on_custom_field_id"
    t.index ["customized_type", "customized_id"], name: "custom_values_customized"
  end

  create_table "customers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "partner_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "school_id"
    t.bigint "partner_manager_group_id"
    t.index ["partner_id"], name: "index_customers_on_partner_id"
    t.index ["partner_manager_group_id"], name: "index_customers_on_partner_manager_group_id"
  end

  create_table "data_exceptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "message"
    t.integer "container_id"
    t.string "container_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "delayed_jobs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "priority", default: 0, null: false
    t.integer "attempts", default: 0, null: false
    t.text "handler", null: false
    t.text "last_error"
    t.datetime "run_at"
    t.datetime "locked_at"
    t.datetime "failed_at"
    t.string "locked_by"
    t.string "queue"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.index ["priority", "run_at"], name: "delayed_jobs_priority"
  end

  create_table "delayed_jobs_20161218", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "id", default: 0, null: false
    t.integer "priority", default: 0, null: false
    t.integer "attempts", default: 0, null: false
    t.text "handler", null: false
    t.text "last_error"
    t.datetime "run_at"
    t.datetime "locked_at"
    t.datetime "failed_at"
    t.string "locked_by"
    t.string "queue"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  create_table "department_members", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "department_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["department_id"], name: "index_department_members_on_department_id"
    t.index ["user_id"], name: "index_department_members_on_user_id"
  end

  create_table "departments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "school_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "is_auth", default: false
    t.string "identifier"
    t.integer "host_count", default: 5
    t.boolean "is_delete", default: false
    t.index ["school_id"], name: "index_departments_on_school_id"
  end

  create_table "diff_record_contents", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "diff_record_id"
    t.text "content"
    t.index ["diff_record_id"], name: "index_diff_record_contents_on_diff_record_id"
  end

  create_table "diff_records", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.string "container_type"
    t.bigint "container_id"
    t.string "column_name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["container_type", "container_id"], name: "index_diff_records_on_container_type_and_container_id"
    t.index ["user_id"], name: "index_diff_records_on_user_id"
  end

  create_table "discipline_categories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "major_level"
    t.string "name"
  end

  create_table "disciplines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.boolean "subject", default: true
    t.boolean "shixun", default: true
    t.boolean "question", default: true
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "position", default: 0
  end

  create_table "discuss_demos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "title"
    t.text "body"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "discusses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "dis_type"
    t.integer "dis_id"
    t.text "content"
    t.integer "parent_id"
    t.integer "root_id"
    t.integer "praise_count"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "challenge_id"
    t.integer "reward"
    t.boolean "hidden", default: false
    t.integer "last_reply_id"
    t.integer "position", limit: 1
    t.integer "praises_count", default: 0
    t.boolean "sticky", default: false
    t.index ["challenge_id"], name: "index_discusses_on_challenge_id"
    t.index ["user_id"], name: "index_discusses_on_user_id"
  end

  create_table "documents", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id", default: 0, null: false
    t.integer "category_id", default: 0, null: false
    t.string "title", limit: 60, default: "", null: false
    t.text "description"
    t.datetime "created_on"
    t.integer "user_id", default: 0
    t.integer "is_public", default: 1
    t.index ["category_id"], name: "index_documents_on_category_id"
    t.index ["created_on"], name: "index_documents_on_created_on"
    t.index ["project_id"], name: "documents_project_id"
  end

  create_table "dts", primary_key: "Num", id: :integer, default: 0, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "Defect", limit: 50
    t.string "Category", limit: 50
    t.string "File"
    t.string "Method"
    t.string "Module", limit: 20
    t.string "Variable", limit: 50
    t.integer "StartLine"
    t.integer "IPLine"
    t.string "IPLineCode", limit: 200
    t.string "Judge", limit: 15
    t.integer "Review", limit: 1
    t.string "Description"
    t.text "PreConditions", limit: 4294967295
    t.text "TraceInfo", limit: 4294967295
    t.text "Code", limit: 4294967295
    t.integer "project_id"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer "id", null: false
  end

  create_table "ec_achievement_evaluation_relates", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_course_achievement_method_id"
    t.integer "ec_course_evaluation_subitem_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "position"
    t.integer "ec_course_target_id"
  end

  create_table "ec_course_achievement_methods", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_course_id"
    t.integer "ec_course_evaluation_id"
    t.integer "ec_course_evaluation_subitem_id"
    t.integer "score"
    t.integer "percentage"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "ec_course_target_id"
  end

  create_table "ec_course_evaluation_subitems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "ec_course_evaluation_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_course_evaluations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "evluation_count"
    t.integer "status", limit: 1
    t.integer "ec_course_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "is_course_type", default: false
    t.boolean "import_status", default: false
    t.integer "score_type", default: 1
  end

  create_table "ec_course_student_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_course_id"
    t.string "student_number"
    t.string "student_name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "ec_year_student_id"
    t.index ["ec_year_student_id"], name: "index_ec_course_scores_on_ec_year_student_id"
  end

  create_table "ec_course_supports", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.float "weigths"
    t.boolean "top_relation"
    t.integer "position", limit: 1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "ec_course_id"
    t.integer "ec_graduation_subitem_id"
  end

  create_table "ec_course_targets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "content"
    t.integer "standard_grade", default: 75
    t.float "weigths"
    t.integer "position", limit: 1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "ec_course_id"
  end

  create_table "ec_course_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_course_id"
    t.integer "user_id"
    t.integer "ec_year_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["ec_course_id"], name: "index_ec_course_users_on_ec_course_id"
    t.index ["ec_year_id"], name: "index_ec_course_users_on_ec_year_id"
    t.index ["user_id"], name: "index_ec_course_users_on_user_id"
  end

  create_table "ec_courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "ec_year_id"
    t.integer "complete_target_count", default: 0
  end

  create_table "ec_discipline_firsts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "code"
    t.integer "ec_discipline_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_disciplines", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "code"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_graduation_requirement_calculations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_course_support_id"
    t.float "target_value", default: 0.0
    t.float "real_value", default: 0.0
    t.boolean "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_graduation_requirements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "content"
    t.integer "ec_year_id"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_graduation_standards", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "content"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_graduation_subitem_course_targets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_graduation_subitem_id"
    t.integer "ec_course_target_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_graduation_subitem_courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_graduation_subitem_id"
    t.integer "ec_course_support_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_graduation_subitems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "content"
    t.integer "ec_graduation_requirement_id"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_major_courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_id"
    t.integer "ec_course_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_major_school_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_major_school_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_major_schools", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_major_id"
    t.integer "school_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "template_major", default: false
  end

  create_table "ec_majors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "code"
    t.string "name"
    t.integer "ec_discipline_first_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_require_sub_vs_standards", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_graduation_subitem_id"
    t.integer "ec_graduation_standard_id"
    t.boolean "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_requirement_vs_objectives", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_graduation_requirement_id"
    t.integer "ec_training_objective_id"
    t.boolean "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_school_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "school_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_score_levels", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "score"
    t.integer "position"
    t.string "level"
    t.integer "ec_course_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_student_achievements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_course_evaluation_subitem_id"
    t.string "student_number"
    t.string "student_name"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "score", default: 0.0
    t.integer "ec_course_evaluation_id"
    t.integer "ec_year_student_id"
    t.index ["ec_course_evaluation_id"], name: "index_ec_student_achievements_on_ec_course_evaluation_id"
    t.index ["ec_course_evaluation_subitem_id"], name: "index_ec_student_achievements_on_ec_course_evaluation_subitem_id"
    t.index ["ec_year_student_id"], name: "index_ec_student_achievements_on_ec_year_student_id"
  end

  create_table "ec_student_score_targets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_course_id"
    t.integer "ec_course_student_score_id"
    t.integer "ec_course_target_id"
    t.integer "ec_target_position"
    t.float "score"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "eaer_id"
    t.integer "ec_year_student_id"
    t.index ["ec_year_student_id"], name: "index_ec_student_targets_on_ec_year_student_id"
  end

  create_table "ec_templates", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_training_objectives", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "content"
    t.integer "ec_year_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_training_subitems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "content"
    t.integer "ec_training_objective_id"
    t.integer "position", limit: 1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ec_year_students", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "ec_year_id"
    t.string "name"
    t.string "student_id"
    t.string "guarantee_school"
    t.string "guarantee_major"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["ec_year_id"], name: "index_ec_year_students_on_ec_year_id"
  end

  create_table "ec_years", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "year"
    t.integer "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "ec_major_school_id"
    t.float "calculation_value", default: 0.7
  end

  create_table "ecloud_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "url"
    t.string "applyno"
    t.integer "custid"
    t.string "custcode"
    t.text "para_value", limit: 4294967295
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "userid"
    t.string "username"
  end

  create_table "ecloud_productparas", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "key"
    t.string "value"
    t.integer "ecloud_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ecloud_services", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "opttype"
    t.string "code"
    t.bigint "begintime"
    t.bigint "endtime"
    t.integer "ecloud_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "packagecode"
    t.string "bossorderid"
    t.string "productcode"
  end

  create_table "ecloud_serviece_serviceparas", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "key"
    t.string "value"
    t.integer "ecloud_service_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ecloud_user_paras", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "key"
    t.string "value"
    t.integer "ecloud_user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ecloud_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "opttype"
    t.integer "userid"
    t.string "username"
    t.string "useralias"
    t.string "mobile"
    t.string "email"
    t.bigint "begintime"
    t.bigint "endtime"
    t.string "paras"
    t.integer "custid"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "ecloud_id"
    t.integer "status", limit: 1
    t.bigint "operatime"
    t.bigint "effecttime"
  end

  create_table "eclouds", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "applyno"
    t.string "ecordercode"
    t.integer "opttype"
    t.boolean "trial"
    t.string "bossorderid"
    t.integer "custid"
    t.string "custcode"
    t.integer "registersource"
    t.integer "custtype"
    t.string "custname"
    t.integer "userid"
    t.string "username"
    t.string "useralias"
    t.string "mobile"
    t.string "productcode"
    t.bigint "begintime"
    t.bigint "endtime"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "email"
    t.bigint "operatime"
    t.bigint "effecttime"
  end

  create_table "ecloudusers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "applyno"
    t.string "ecordercoder"
    t.string "string"
    t.integer "opttype"
    t.boolean "trial"
    t.string "bossorderid"
    t.integer "custid"
    t.string "custcod"
    t.integer "custtype"
    t.integer "registersource"
    t.string "custname"
    t.integer "userid"
    t.string "username"
    t.string "useralias"
    t.string "moblile"
    t.string "email"
    t.string "productcode"
    t.datetime "begintime"
    t.datetime "endtime"
    t.string "productparas"
    t.string "services"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "editor_of_documents", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "editor_id"
    t.integer "org_document_comment_id"
    t.datetime "created_at"
  end

  create_table "edu_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "value"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "description"
    t.index ["name"], name: "index_edu_settings_on_name", unique: true
  end

  create_table "enabled_modules", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.string "name", null: false
    t.integer "course_id"
    t.index ["project_id"], name: "enabled_modules_project_id"
  end

  create_table "enumerations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", limit: 30, default: "", null: false
    t.integer "position", default: 1
    t.boolean "is_default", default: false, null: false
    t.string "type"
    t.boolean "active", default: true, null: false
    t.integer "project_id"
    t.integer "parent_id"
    t.string "position_name", limit: 30
    t.index ["id", "type"], name: "index_enumerations_on_id_and_type"
    t.index ["project_id"], name: "index_enumerations_on_project_id"
  end

  create_table "error_checks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "game_indentifier"
    t.string "login"
    t.string "path"
  end

  create_table "evaluate_records", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "shixun_id"
    t.integer "game_id"
    t.float "consume_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "file_update"
    t.float "git_pull"
    t.float "create_pod"
    t.float "pod_execute"
    t.float "student_work"
    t.float "test_cases"
    t.float "retry"
    t.float "game_build"
    t.float "return_back"
    t.float "brige"
    t.datetime "create_status"
    t.float "front_js"
    t.string "identifier"
    t.float "max_mem"
    t.integer "exec_time"
    t.index ["game_id"], name: "index_evaluate_records_on_game_id"
    t.index ["identifier"], name: "index_evaluate_records_on_identifier", unique: true
  end

  create_table "evaluate_records201905", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "id", default: 0, null: false
    t.integer "user_id"
    t.integer "shixun_id"
    t.integer "game_id"
    t.float "consume_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "file_update"
    t.float "git_pull"
    t.float "create_pod"
    t.float "pod_execute"
    t.float "student_work"
    t.float "test_cases"
    t.float "retry"
    t.float "game_build"
    t.float "return_back"
    t.float "brige"
    t.datetime "create_status"
    t.float "front_js"
  end

  create_table "evaluate_records_20181022", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "id", default: 0, null: false
    t.integer "user_id"
    t.integer "shixun_id"
    t.integer "game_id"
    t.float "consume_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "file_update"
    t.float "git_pull"
    t.float "create_pod"
    t.float "pod_execute"
    t.float "student_work"
    t.float "test_cases"
    t.float "retry"
    t.float "game_build"
    t.float "return_back"
    t.float "brige"
    t.datetime "create_status"
    t.float "front_js"
  end

  create_table "examination_bank_random_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "difficulty", comment: "难度"
    t.integer "sub_discipline_id", comment: "课程"
    t.integer "quanlity", comment: "题目数量"
    t.integer "item_type", comment: "题目类型"
    t.integer "examination_bank_id", comment: "外键,关联examination_bank"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["examination_bank_id"], name: "index_examination_bank_random_settings_on_examination_bank_id"
    t.index ["item_type"], name: "index_examination_bank_random_settings_on_item_type"
  end

  create_table "examination_bank_score_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "item_type", comment: "题目类型"
    t.integer "score", comment: "分数设置"
    t.integer "examination_bank_id", comment: "外键,关联examination_bank"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["examination_bank_id"], name: "index_examination_bank_score_settings_on_examination_bank_id"
  end

  create_table "examination_banks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "difficulty", default: 1
    t.bigint "user_id"
    t.boolean "public", default: false
    t.integer "quotes", default: 0
    t.bigint "sub_discipline_id"
    t.integer "duration"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "intelligent", default: false
    t.integer "time", default: -1, comment: "考试时长，默认-1，表示没有设置时长"
    t.integer "source", default: 1, comment: "试卷来源,默认为仅私有题库"
    t.boolean "is_random", default: false, comment: "是否为随机组卷"
    t.index ["sub_discipline_id"], name: "index_examination_banks_on_sub_discipline_id"
    t.index ["user_id"], name: "index_examination_banks_on_user_id"
  end

  create_table "examination_intelligent_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "sub_discipline_id"
    t.integer "public", default: 1
    t.integer "difficulty", default: 1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "user_id"
    t.index ["sub_discipline_id"], name: "index_examination_intelligent_settings_on_sub_discipline_id"
    t.index ["sub_discipline_id"], name: "index_on_sub_discipline_id"
  end

  create_table "examination_item_analyses", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "examination_item_id"
    t.text "analysis"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["examination_item_id"], name: "index_examination_item_analyses_on_examination_item_id"
  end

  create_table "examination_item_choices", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "examination_item_id"
    t.text "choice_text"
    t.boolean "is_answer", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["examination_item_id"], name: "index_examination_item_choices_on_examination_item_id"
  end

  create_table "examination_items", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "examination_bank_id"
    t.bigint "item_bank_id"
    t.text "name"
    t.integer "item_type", default: 0
    t.integer "difficulty", default: 1
    t.float "score", default: 0.0
    t.integer "position", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "container_id"
    t.string "container_type"
    t.boolean "is_ordered", default: true
    t.index ["examination_bank_id"], name: "index_examination_items_on_examination_bank_id"
    t.index ["item_bank_id"], name: "index_examination_items_on_item_bank_id"
  end

  create_table "examination_standard_answers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "examination_item_id", comment: "外键,关联examination_item"
    t.integer "position", comment: "表示选项的序号,并非外键,相同的position表示,填空题中同一个空的答案"
    t.text "answer_text"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["examination_item_id"], name: "index_examination_standard_answers_on_examination_item_id"
  end

  create_table "examination_type_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "examination_intelligent_setting_id"
    t.integer "item_type"
    t.integer "count"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["examination_intelligent_setting_id"], name: "index_on_examination_intelligent_setting"
  end

  create_table "exercise_answer_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "exercise_answer_id"
    t.integer "user_id"
    t.integer "exercise_question_id"
    t.text "comment"
    t.decimal "score", precision: 10, scale: 1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "exercise_shixun_answer_id"
    t.integer "exercise_user_id"
    t.index ["exercise_answer_id"], name: "index_exercise_answer_comments_on_exercise_answer_id"
    t.index ["exercise_question_id"], name: "index_exercise_answer_comments_on_exercise_question_id"
    t.index ["exercise_shixun_answer_id"], name: "exercise_shixun_answer_comment_id"
    t.index ["user_id"], name: "index_exercise_answer_comments_on_user_id"
  end

  create_table "exercise_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "exercise_question_id"
    t.integer "exercise_choice_id", default: -1
    t.text "answer_text"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.decimal "score", precision: 10, scale: 1, default: "-1.0"
    t.integer "choice_index", default: 1
    t.index ["exercise_question_id", "user_id", "choice_index"], name: "exercise_user_choice_index", unique: true
  end

  create_table "exercise_bank_choices", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "exercise_bank_question_id"
    t.text "choice_text"
    t.integer "choice_position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exercise_bank_question_id"], name: "index_exercise_bank_choices_on_exercise_bank_question_id"
  end

  create_table "exercise_bank_questions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "question_title"
    t.integer "question_type"
    t.integer "question_number"
    t.decimal "question_score", precision: 10, scale: 1
    t.integer "exercise_bank_id"
    t.integer "max_choices"
    t.integer "min_choices"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "shixun_id"
    t.integer "is_necessary", default: 1
    t.string "shixun_name"
    t.boolean "is_ordered", default: true
    t.index ["exercise_bank_id"], name: "index_exercise_bank_questions_on_exercise_bank_id"
  end

  create_table "exercise_bank_questions_backup", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "question_title"
    t.integer "question_type"
    t.integer "question_number"
    t.decimal "question_score", precision: 10, scale: 1
    t.integer "exercise_bank_id"
    t.integer "max_choices"
    t.integer "min_choices"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "shixun_id"
    t.integer "is_necessary", default: 1
    t.string "shixun_name"
    t.index ["exercise_bank_id"], name: "index_exercise_bank_questions_on_exercise_bank_id"
  end

  create_table "exercise_bank_random_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "difficulty", comment: "难度"
    t.integer "sub_discipline_id", comment: "课程"
    t.integer "quanlity", comment: "题目数量"
    t.integer "item_type", comment: "题目类型"
    t.integer "exercise_bank_id", comment: "外键,关联exercise_bank"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exercise_bank_id"], name: "index_exercise_bank_random_settings_on_exercise_bank_id"
    t.index ["item_type"], name: "index_exercise_bank_random_settings_on_item_type"
  end

  create_table "exercise_bank_score_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "item_type", comment: "题目类型"
    t.integer "score", comment: "分数设置"
    t.integer "exercise_bank_id", comment: "外键,关联exercise_bank"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exercise_bank_id"], name: "index_exercise_bank_score_settings_on_exercise_bank_id"
  end

  create_table "exercise_bank_shixun_challenges", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "challenge_id"
    t.integer "shixun_id"
    t.integer "exercise_bank_question_id"
    t.decimal "question_score", precision: 10, scale: 1
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["challenge_id"], name: "index_exercise_bank_shixun_challenges_on_challenge_id"
    t.index ["shixun_id"], name: "index_exercise_bank_shixun_challenges_on_shixun_id"
  end

  create_table "exercise_bank_standard_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "exercise_bank_question_id"
    t.integer "exercise_bank_choice_id"
    t.text "answer_text"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "exercise_bank_standard_answers_backup", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "exercise_bank_question_id"
    t.integer "exercise_bank_choice_id"
    t.text "answer_text"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "exercise_banks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "user_id"
    t.boolean "is_public"
    t.integer "quotes"
    t.integer "container_id"
    t.string "container_type"
    t.integer "course_list_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "is_md", default: true
    t.index ["course_list_id"], name: "index_exercise_banks_on_course_list_id"
    t.index ["user_id"], name: "index_exercise_banks_on_user_id"
  end

  create_table "exercise_choices", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "exercise_question_id"
    t.text "choice_text"
    t.integer "choice_position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exercise_question_id"], name: "index_exercise_choices_on_exercise_question_id"
  end

  create_table "exercise_group_settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "exercise_id"
    t.integer "course_group_id"
    t.integer "course_id"
    t.datetime "publish_time"
    t.datetime "end_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_group_id"], name: "index_exercise_group_settings_on_course_group_id"
    t.index ["course_id"], name: "index_exercise_group_settings_on_course_id"
    t.index ["exercise_id"], name: "index_exercise_group_settings_on_exercise_id"
  end

  create_table "exercise_question_analyses", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "analysis"
    t.bigint "exercise_question_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exercise_question_id"], name: "index_exercise_question_analyses_on_exercise_question_id"
  end

  create_table "exercise_questions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "question_title"
    t.integer "question_type"
    t.integer "question_number"
    t.integer "exercise_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.decimal "question_score", precision: 10, scale: 1, default: "0.0"
    t.integer "shixun_id"
    t.string "shixun_name"
    t.boolean "is_ordered", default: true
    t.integer "hack_id", default: 0
    t.index ["exercise_id"], name: "index_exercise_questions_on_exercise_id"
  end

  create_table "exercise_questions_backup", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "question_title"
    t.integer "question_type"
    t.integer "question_number"
    t.integer "exercise_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.decimal "question_score", precision: 10, scale: 1, default: "0.0"
    t.integer "shixun_id"
    t.string "shixun_name"
    t.boolean "is_ordered", default: true
    t.index ["exercise_id"], name: "index_exercise_questions_on_exercise_id"
  end

  create_table "exercise_random_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "difficulty", comment: "难度"
    t.integer "sub_discipline_id", comment: "课程"
    t.integer "quanlity", comment: "题目数量"
    t.integer "item_type", comment: "题目类型"
    t.integer "exercise_id", comment: "外键,关联exercise"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exercise_id"], name: "index_exercise_random_settings_on_exercise_id"
    t.index ["item_type"], name: "index_exercise_random_settings_on_item_type"
  end

  create_table "exercise_score_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "item_type", comment: "题目类型"
    t.integer "score", comment: "分数设置"
    t.integer "exercise_id", comment: "外键,关联exercise"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exercise_id"], name: "index_exercise_score_settings_on_exercise_id"
  end

  create_table "exercise_shixun_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "exercise_question_id"
    t.integer "user_id"
    t.integer "exercise_shixun_challenge_id"
    t.text "answer_text"
    t.decimal "score", precision: 10, scale: 1
    t.integer "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "is_invalid", default: false
    t.index ["exercise_question_id", "user_id"], name: "exercise_question_id_user_id"
    t.index ["user_id", "exercise_shixun_challenge_id"], name: "index_user_id_and_exercise_shixun_challenge_id", unique: true
  end

  create_table "exercise_shixun_challenges", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "challenge_id"
    t.integer "shixun_id"
    t.integer "exercise_question_id"
    t.decimal "question_score", precision: 10, scale: 1, default: "0.0"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["challenge_id"], name: "index_exercise_shixun_challenges_on_challenge_id"
    t.index ["exercise_question_id"], name: "index_exercise_shixun_challenges_on_exercise_question_id"
  end

  create_table "exercise_standard_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "exercise_question_id"
    t.integer "exercise_choice_id"
    t.text "answer_text"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exercise_question_id"], name: "index_exercise_standard_answers_on_exercise_question_id"
  end

  create_table "exercise_user_questions", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "exercise_id"
    t.integer "exercise_user_id"
    t.integer "user_id"
    t.integer "exercise_question_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["exercise_id"], name: "index_exercise_user_questions_on_exercise_id"
    t.index ["exercise_question_id"], name: "index_exercise_user_questions_on_exercise_question_id"
    t.index ["exercise_user_id", "exercise_question_id"], name: "index_on_user_question", unique: true
    t.index ["exercise_user_id"], name: "index_exercise_user_questions_on_exercise_user_id"
    t.index ["user_id"], name: "index_exercise_user_questions_on_user_id"
  end

  create_table "exercise_user_scores", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "exercise_id"
    t.bigint "exercise_user_id"
    t.float "score"
    t.text "comment"
    t.bigint "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "subjective_score", default: 0.0
    t.float "objective_score", default: 0.0
    t.index ["exercise_id"], name: "index_exercise_user_scores_on_exercise_id"
    t.index ["exercise_user_id"], name: "index_exercise_user_scores_on_exercise_user_id"
    t.index ["user_id"], name: "index_exercise_user_scores_on_user_id"
  end

  create_table "exercise_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "exercise_id"
    t.decimal "score", precision: 10, scale: 1
    t.datetime "start_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.datetime "end_at"
    t.integer "status"
    t.integer "commit_status", default: 0
    t.decimal "objective_score", precision: 10, scale: 1, default: "0.0"
    t.decimal "subjective_score", precision: 10, scale: 1, default: "-1.0"
    t.boolean "is_delete", default: false
    t.integer "commit_method", default: 0
    t.boolean "subjective_reviewed", default: false
    t.boolean "reviewed", default: false
    t.index ["exercise_id", "user_id"], name: "index_on_exercise_id_user_id", unique: true
  end

  create_table "exercises", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "exercise_name"
    t.text "exercise_description"
    t.integer "course_id"
    t.integer "exercise_status", default: 1
    t.integer "user_id"
    t.integer "time", default: -1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.datetime "publish_time"
    t.datetime "end_time"
    t.integer "show_result", default: 0
    t.boolean "question_random", default: true
    t.boolean "choice_random", default: true
    t.boolean "is_public", default: false
    t.boolean "score_open", default: false
    t.boolean "answer_open", default: false
    t.integer "exercise_bank_id"
    t.boolean "unified_setting", default: true
    t.boolean "show_statistic", default: false
    t.boolean "assistant_auth", default: true
    t.integer "examination_bank_id", default: 0
    t.boolean "is_md", default: true
    t.integer "source", default: 1, comment: "试卷来源,默认为仅私有题库"
    t.boolean "is_random", default: false, comment: "是否为随机组卷"
    t.integer "difficulty", comment: "试卷难度(来自于随机组卷)"
    t.index ["course_id"], name: "index_exercises_on_course_id"
  end

  create_table "experiences", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "container_id"
    t.string "container_type"
    t.integer "score"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["container_id", "user_id"], name: "exper"
  end

  create_table "first_level_disciplines", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "discipline_category_id"
    t.string "name"
    t.index ["discipline_category_id"], name: "index_first_level_disciplines_on_discipline_category_id"
  end

  create_table "first_pages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "web_title"
    t.string "title"
    t.text "description"
    t.string "page_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "sort_type"
    t.integer "image_width", default: 107
    t.integer "image_height", default: 63
    t.integer "show_course", default: 1
    t.integer "show_contest", default: 1
  end

  create_table "forge_activities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "project_id"
    t.integer "forge_act_id"
    t.string "forge_act_type"
    t.integer "org_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["forge_act_id"], name: "index_forge_activities_on_forge_act_id"
    t.index ["project_id", "forge_act_id", "created_at", "forge_act_type"], name: "forge_act_index"
  end

  create_table "forge_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "project_id"
    t.integer "forge_message_id"
    t.string "forge_message_type"
    t.integer "viewed"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "secret_key"
    t.integer "status"
    t.integer "operate_user_id"
    t.index ["forge_message_id", "forge_message_type"], name: "index_forge_messages_on_forge_message_id_and_forge_message_type"
    t.index ["user_id", "project_id", "created_at"], name: "index_forge_messages_on_user_id_and_project_id_and_created_at"
  end

  create_table "forums", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", null: false
    t.text "description"
    t.integer "topic_count", default: 0
    t.integer "memo_count", default: 0
    t.integer "last_memo_id", default: 0
    t.integer "creator_id", null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "sticky"
    t.integer "locked"
    t.integer "visits", default: 0
  end

  create_table "forwards", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "from_id"
    t.string "from_type"
    t.integer "to_id"
    t.string "to_type"
    t.datetime "created_at"
  end

  create_table "game_answers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "challenge_answer_id"
    t.bigint "user_id"
    t.bigint "game_id"
    t.datetime "view_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["challenge_answer_id", "user_id"], name: "index_game_answers_on_challenge_answer_id_and_user_id", unique: true
    t.index ["challenge_answer_id"], name: "index_game_answers_on_challenge_answer_id"
    t.index ["game_id"], name: "index_game_answers_on_game_id"
    t.index ["user_id"], name: "index_game_answers_on_user_id"
  end

  create_table "game_codes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "game_id"
    t.text "original_code", limit: 4294967295
    t.text "new_code", limit: 4294967295
    t.string "path"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "current_code", limit: 4294967295
    t.integer "votes", default: 0
    t.index ["game_id"], name: "game_id"
  end

  create_table "game_outputs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "code"
    t.integer "game_id"
    t.text "msg"
    t.text "out_put"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "games", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "myshixun_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "status", default: 0
    t.integer "final_score", default: 0
    t.integer "challenge_id"
    t.datetime "open_time"
    t.string "identifier"
    t.integer "answer_open", default: 0
    t.datetime "end_time"
    t.integer "retry_status", default: 0
    t.string "resubmit_identifier"
    t.boolean "test_sets_view", default: false
    t.text "picture_path"
    t.float "accuracy"
    t.datetime "modify_time"
    t.integer "star", default: 0
    t.integer "cost_time", default: 0
    t.integer "evaluate_count", default: 0
    t.integer "answer_deduction", default: 0
    t.timestamp "play_time"
    t.integer "play_sign", default: 0
    t.index ["challenge_id"], name: "challenge"
    t.index ["identifier"], name: "index_games_on_identifier"
    t.index ["myshixun_id"], name: "myshixun"
    t.index ["user_id", "challenge_id"], name: "index_games_on_user_id_and_challenge_id", unique: true
    t.index ["user_id"], name: "index_games_on_user_id"
  end

  create_table "gitlab_urls", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "myshixun_id"
    t.string "url"
    t.string "myshixun_identifier"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "grades", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "container_id"
    t.string "container_type"
    t.integer "score"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["container_id", "container_type"], name: "index_grades_on_container_id_and_container_type"
    t.index ["user_id"], name: "index_grades_on_user_id"
  end

  create_table "graduation_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_id"
    t.integer "user_id"
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_id"], name: "index_graduation_groups_on_course_id"
    t.index ["user_id"], name: "index_graduation_groups_on_user_id"
  end

  create_table "graduation_task_group_assignations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "graduation_task_id"
    t.integer "graduation_group_id"
    t.integer "assign_graduation_group_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "graduation_work_id", default: 0
    t.integer "temporary", default: 0
    t.index ["graduation_group_id"], name: "index_graduation_task_group_assignations_on_graduation_group_id"
    t.index ["graduation_task_id"], name: "index_graduation_task_group_assignations_on_graduation_task_id"
    t.index ["graduation_work_id"], name: "index_graduation_task_group_assignations_on_graduation_work_id"
  end

  create_table "graduation_tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "user_id"
    t.text "description"
    t.integer "status", default: 0
    t.datetime "publish_time"
    t.datetime "end_time"
    t.integer "task_type", default: 1
    t.integer "course_id"
    t.boolean "cross_comment", default: false
    t.integer "min_num", default: 2
    t.integer "max_num", default: 5
    t.boolean "base_on_project", default: false
    t.boolean "allow_late", default: false
    t.integer "late_penalty", default: 0
    t.datetime "comment_time"
    t.integer "comment_num", default: 3
    t.integer "comment_status", default: 0
    t.boolean "open_work", default: false
    t.boolean "open_score", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "is_public", default: false
    t.datetime "late_time"
    t.integer "gtask_bank_id"
    t.index ["course_id"], name: "index_graduation_tasks_on_course_id"
  end

  create_table "graduation_topics", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "course_id"
    t.integer "tea_id"
    t.string "name"
    t.text "description"
    t.integer "status", default: 0
    t.integer "topic_type"
    t.integer "topic_source"
    t.integer "topic_property_first"
    t.integer "topic_property_second"
    t.string "source_unit"
    t.integer "topic_repeat"
    t.string "province"
    t.string "city"
    t.boolean "is_public", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "quotes", default: 0
    t.integer "gtopic_bank_id"
    t.index ["course_id"], name: "index_graduation_topics_on_course_id"
  end

  create_table "graduation_work_comment_assignations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "graduation_work_id"
    t.integer "graduation_task_id"
    t.integer "user_id"
    t.integer "graduation_group_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "temporary", default: 0
    t.index ["graduation_task_id"], name: "index_graduation_work_comment_assignations_on_graduation_task_id"
    t.index ["graduation_work_id"], name: "index_graduation_work_comment_assignations_on_graduation_work_id"
    t.index ["user_id"], name: "index_graduation_work_comment_assignations_on_user_id"
  end

  create_table "graduation_work_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "graduation_work_id"
    t.integer "user_id"
    t.integer "graduation_task_id"
    t.float "score"
    t.text "comment"
    t.integer "reviewer_role"
    t.boolean "is_hidden", default: false
    t.boolean "is_ultimate", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "is_invalid", default: false
    t.index ["graduation_work_id"], name: "index_graduation_work_scores_on_graduation_work_id"
    t.index ["user_id"], name: "index_graduation_work_scores_on_user_id"
  end

  create_table "graduation_works", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "graduation_task_id"
    t.text "description"
    t.integer "course_id"
    t.float "teacher_score"
    t.float "cross_score"
    t.float "work_score"
    t.integer "project_id", default: 0
    t.integer "late_penalty", default: 0
    t.integer "work_status", default: 0
    t.datetime "commit_time"
    t.integer "group_id", default: 0
    t.integer "commit_user_id"
    t.boolean "ultimate_score", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "final_score"
    t.datetime "update_time"
    t.boolean "is_delete", default: false
    t.integer "update_user_id"
    t.index ["graduation_task_id", "user_id"], name: "index_graduation_task_id_and_user_id", unique: true
  end

  create_table "groups_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "group_id", null: false
    t.integer "user_id", null: false
    t.index ["group_id", "user_id"], name: "groups_users_ids", unique: true
  end

  create_table "gtask_banks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.string "name"
    t.text "description"
    t.integer "task_type"
    t.integer "min_num", default: 0
    t.integer "max_num", default: 0
    t.integer "base_on_project", default: 0
    t.boolean "is_public", default: false
    t.integer "quotes", default: 0
    t.bigint "graduation_task_id"
    t.bigint "course_list_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_list_id"], name: "index_gtask_banks_on_course_list_id"
    t.index ["graduation_task_id"], name: "index_gtask_banks_on_graduation_task_id"
    t.index ["user_id"], name: "index_gtask_banks_on_user_id"
  end

  create_table "gtopic_banks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.string "name"
    t.text "description"
    t.integer "quotes", default: 0
    t.boolean "is_public", default: false
    t.integer "topic_type"
    t.integer "topic_source"
    t.integer "topic_property_first"
    t.integer "topic_property_second"
    t.string "source_unit"
    t.integer "topic_repeat"
    t.string "province"
    t.string "city"
    t.bigint "graduation_topic_id"
    t.bigint "course_list_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_list_id"], name: "index_gtopic_banks_on_course_list_id"
    t.index ["graduation_topic_id"], name: "index_gtopic_banks_on_graduation_topic_id"
    t.index ["user_id"], name: "index_gtopic_banks_on_user_id"
  end

  create_table "hack_codes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "hack_id"
    t.text "code", limit: 4294967295
    t.string "language"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.timestamp "modify_time"
    t.index ["hack_id", "language"], name: "index_hack_codes_on_hack_id_and_language", unique: true
    t.index ["hack_id"], name: "index_hack_codes_on_hack_id"
  end

  create_table "hack_sets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "hack_id"
    t.text "input"
    t.text "output"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "score"
    t.index ["hack_id", "position"], name: "index_hack_sets_on_hack_id_and_position", unique: true
    t.index ["hack_id"], name: "index_hack_sets_on_hack_id"
  end

  create_table "hack_user_codes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "hack_id"
    t.text "code", limit: 4294967295
    t.text "output"
    t.text "error_msg"
    t.integer "error_line"
    t.integer "position"
    t.integer "status", default: 0
    t.integer "query_index"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "execute_time"
    t.integer "execute_memory"
    t.text "input"
    t.integer "hack_user_lastest_code_id"
    t.text "expected_output"
    t.integer "error_test_set_id"
    t.string "language"
    t.index ["hack_id"], name: "index_hack_user_codes_on_hack_id"
    t.index ["hack_user_lastest_code_id"], name: "index_hack_user_codes_on_hack_user_lastest_code_id"
    t.index ["user_id", "hack_id", "query_index"], name: "index_hack_user_codes_on_user_id_and_hack_id_and_query_index", unique: true
    t.index ["user_id"], name: "index_hack_user_codes_on_user_id"
  end

  create_table "hack_user_debugs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "hack_id"
    t.text "output"
    t.text "input"
    t.text "error_msg"
    t.integer "error_line"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "execute_time"
    t.integer "execute_memory"
    t.integer "hack_user_lastest_code_id"
    t.integer "status"
    t.text "code", limit: 4294967295
    t.index ["hack_id"], name: "index_hack_user_debugs_on_hack_id"
    t.index ["hack_user_lastest_code_id"], name: "index_hack_user_debugs_on_hack_user_lastest_code_id", unique: true
    t.index ["user_id"], name: "index_hack_user_debugs_on_user_id"
  end

  create_table "hack_user_lastest_codes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "hack_id"
    t.text "code", limit: 4294967295
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "passed", default: false
    t.string "identifier"
    t.string "language"
    t.integer "submit_status", default: 0
    t.integer "status"
    t.timestamp "passed_time"
    t.timestamp "modify_time"
    t.text "notes", limit: 4294967295
    t.integer "score", default: 0
    t.index ["hack_id"], name: "hack_index"
    t.index ["hack_id"], name: "index_hack_user_lastest_codes_on_hack_id"
    t.index ["identifier"], name: "index_hack_user_lastest_codes_on_identifier", unique: true
    t.index ["user_id", "hack_id"], name: "index_hack_user_lastest_codes_on_user_id_and_hack_id", unique: true
    t.index ["user_id"], name: "index_hack_user_lastest_codes_on_user_id"
    t.index ["user_id"], name: "user_index"
  end

  create_table "hack_users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "trustie_hack_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["trustie_hack_id"], name: "index_hack_users_on_trustie_hack_id"
    t.index ["user_id", "trustie_hack_id"], name: "index_hack_users_on_user_id_and_trustie_hack_id", unique: true
    t.index ["user_id"], name: "index_hack_users_on_user_id"
  end

  create_table "hacks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "difficult"
    t.integer "category"
    t.integer "status", default: 0
    t.boolean "open_or_not", default: false
    t.integer "time_limit"
    t.integer "memory_limit"
    t.string "identifier"
    t.bigint "user_id"
    t.text "description", limit: 4294967295
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "score"
    t.integer "hack_user_lastest_codes_count", default: 0
    t.integer "pass_num", default: 0
    t.integer "submit_num", default: 0
    t.integer "praises_count", default: 0
    t.integer "comments_count", default: 0
    t.integer "sub_discipline_id"
    t.integer "fork_id", default: 0
    t.boolean "test_set_score", default: false
    t.boolean "test_set_average", default: true
    t.index ["identifier"], name: "index_hacks_on_identifier", unique: true
    t.index ["user_id"], name: "index_hacks_on_user_id"
  end

  create_table "helps", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "about_us"
    t.text "agreement"
    t.text "status"
    t.text "help_center"
  end

  create_table "homepages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "article_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_homepages_on_user_id"
  end

  create_table "homework_attaches", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "bid_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "reward"
    t.string "name"
    t.text "description"
    t.integer "state"
    t.integer "project_id", default: 0
    t.float "score", default: 0.0
    t.integer "is_teacher_score", default: 0
    t.index ["bid_id"], name: "index_homework_attaches_on_bid_id"
  end

  create_table "homework_bank_samples", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "input"
    t.text "output"
    t.integer "homework_bank_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["homework_bank_id"], name: "index_homework_bank_samples_on_homework_bank_id"
  end

  create_table "homework_bank_shixuns", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "homework_bank_id"
    t.integer "shixun_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["homework_bank_id"], name: "index_homework_bank_shixuns_on_homework_bank_id"
    t.index ["shixun_id"], name: "index_homework_bank_shixuns_on_shixun_id"
  end

  create_table "homework_bank_tests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "input"
    t.text "output"
    t.boolean "test_type"
    t.integer "homework_bank_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "homework_banks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "name"
    t.text "description"
    t.integer "homework_type"
    t.integer "quotes", default: 0
    t.boolean "is_public"
    t.string "language"
    t.text "standard_code", limit: 4294967295
    t.integer "min_num"
    t.integer "max_num"
    t.boolean "base_on_project"
    t.string "applicable_syllabus"
    t.integer "homework_common_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "reference_answer"
    t.integer "syllabus_id"
    t.text "major_level"
    t.text "discipline_category_id"
    t.text "first_level_discipline_id"
    t.integer "course_list_id"
    t.index ["user_id"], name: "index_homework_banks_on_user_id"
  end

  create_table "homework_challenge_settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "homework_common_id"
    t.integer "challenge_id"
    t.integer "shixun_id"
    t.float "score"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["challenge_id"], name: "index_homework_challenge_settings_on_challenge_id"
    t.index ["homework_common_id", "challenge_id"], name: "index_on_homework_common_id_challenge_id", unique: true
    t.index ["homework_common_id"], name: "index_homework_challenge_settings_on_homework_common_id"
  end

  create_table "homework_commons", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "user_id"
    t.text "description"
    t.datetime "publish_time"
    t.datetime "end_time"
    t.integer "homework_type", default: 1
    t.string "late_penalty", default: "0"
    t.integer "course_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "teacher_priority", default: 1
    t.boolean "anonymous_comment", default: false
    t.integer "quotes", default: 0
    t.integer "is_open", default: 0
    t.datetime "simi_time"
    t.boolean "score_open", default: false
    t.boolean "anonymous_appeal", default: false
    t.integer "homework_bank_id"
    t.boolean "is_update", default: false
    t.boolean "is_public", default: false
    t.text "reference_answer"
    t.boolean "answer_public", default: false
    t.datetime "archive_time"
    t.boolean "allow_late", default: false
    t.datetime "late_time"
    t.boolean "work_public", default: false
    t.text "explanation"
    t.boolean "unified_setting", default: true
    t.boolean "comment_public", default: true
    t.integer "course_homework_category_id"
    t.boolean "work_efficiency", default: false
    t.float "eff_score", default: 0.0
    t.float "max_efficiency", default: 0.0
    t.integer "course_second_category_id", default: 0
    t.datetime "calculation_time"
    t.integer "position", default: 0
    t.float "total_score", default: 100.0
    t.index ["course_id", "id"], name: "index_homework_commons_on_course_id_and_id"
    t.index ["course_second_category_id"], name: "index_homework_commons_on_course_second_category_id"
    t.index ["homework_bank_id"], name: "index_homework_commons_on_homework_bank_id"
  end

  create_table "homework_commons_shixuns", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.integer "homework_common_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["homework_common_id"], name: "index_homework_commons_shixuns_on_homework_common_id"
  end

  create_table "homework_detail_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "homework_common_id"
    t.integer "min_num"
    t.integer "max_num"
    t.boolean "base_on_project", default: true
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["homework_common_id"], name: "index_homework_detail_groups_on_homework_common_id"
  end

  create_table "homework_detail_manuals", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.float "ta_proportion", default: 0.0
    t.integer "comment_status", default: 0
    t.datetime "evaluation_start"
    t.datetime "evaluation_end"
    t.integer "evaluation_num", default: 0
    t.integer "absence_penalty", default: 0
    t.integer "homework_common_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "no_anon_penalty", default: 1
    t.integer "appeal_penalty", default: 0
    t.integer "ta_mode", default: 1
    t.datetime "appeal_time"
    t.float "te_proportion", default: 1.0
    t.boolean "final_mode", default: false
    t.boolean "answer_open_evaluation", default: false
    t.integer "shixun_evaluation", default: 0
    t.boolean "student_comment", default: true
    t.index ["homework_common_id"], name: "index_homework_detail_manuals_on_homework_common_id"
  end

  create_table "homework_detail_programings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "language"
    t.text "standard_code", limit: 4294967295
    t.integer "homework_common_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "ta_proportion", default: 0.1
    t.integer "question_id"
  end

  create_table "homework_evaluations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "user_id"
    t.string "homework_attach_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "homework_for_courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_id"
    t.integer "bid_id"
    t.index ["bid_id"], name: "index_homework_for_courses_on_bid_id"
    t.index ["course_id"], name: "index_homework_for_courses_on_course_id"
  end

  create_table "homework_group_reviews", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "homework_common_id"
    t.integer "course_group_id"
    t.integer "user_id"
    t.integer "status", default: 0
    t.string "query_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_group_id"], name: "index_homework_group_reviews_on_course_group_id"
    t.index ["homework_common_id"], name: "index_homework_group_reviews_on_homework_common_id"
    t.index ["user_id"], name: "index_homework_group_reviews_on_user_id"
  end

  create_table "homework_group_settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "homework_common_id"
    t.integer "course_group_id"
    t.integer "course_id"
    t.datetime "publish_time"
    t.datetime "end_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_group_id"], name: "index_homework_group_settings_on_course_group_id"
    t.index ["course_id"], name: "index_homework_group_settings_on_course_id"
    t.index ["homework_common_id"], name: "index_homework_group_settings_on_homework_common_id"
  end

  create_table "homework_reference_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "answer"
    t.integer "homework_common_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["homework_common_id"], name: "index_homework_reference_answers_on_homework_common_id"
  end

  create_table "homework_review_results", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "homework_common_id"
    t.integer "user_id"
    t.float "code_rate"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["homework_common_id"], name: "index_homework_review_results_on_homework_common_id"
    t.index ["user_id"], name: "index_homework_review_results_on_user_id"
  end

  create_table "homework_samples", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "input"
    t.text "output"
    t.integer "homework_common_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["homework_common_id"], name: "index_homework_samples_on_homework_common_id"
  end

  create_table "homework_seconds", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "user_id"
    t.text "description"
    t.datetime "publish_time"
    t.datetime "end_time"
    t.integer "homework_type", default: 1
    t.string "late_penalty"
    t.integer "course_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "teacher_priority", default: 1
    t.integer "anonymous_comment", default: 0
    t.integer "quotes", default: 0
    t.integer "is_open", default: 0
    t.datetime "simi_time"
    t.integer "score_open", default: 1
    t.integer "anonymous_appeal", default: 0
    t.integer "homework_bank_id"
    t.boolean "is_update", default: false
    t.boolean "is_public", default: false
    t.text "reference_answer"
    t.boolean "answer_public", default: true
    t.datetime "archive_time"
    t.boolean "allow_late", default: true
    t.datetime "late_time"
    t.boolean "work_public", default: true
    t.text "explanation"
    t.boolean "unified_setting", default: true
    t.boolean "comment_public", default: true
    t.integer "course_homework_category_id"
    t.boolean "work_efficiency", default: true
    t.integer "eff_score", default: 20
    t.float "max_efficiency", default: 0.0
    t.index ["course_homework_category_id"], name: "index_homework_seconds_on_course_homework_category_id"
    t.index ["course_id", "id"], name: "index_homework_seconds_on_course_id_and_id"
  end

  create_table "homework_tests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "input"
    t.text "output"
    t.integer "homework_common_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "result"
    t.text "error_msg"
  end

  create_table "homework_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "homework_attach_id"
    t.string "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "import_course_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "user_student_id"
    t.string "user_name"
    t.string "user_group_name"
    t.integer "course_id"
    t.integer "school_id"
    t.boolean "status", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_id"], name: "index_import_course_users_on_course_id"
    t.index ["school_id"], name: "index_import_course_users_on_school_id"
  end

  create_table "import_students", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "student_number"
    t.integer "course_id"
    t.integer "school_id"
    t.integer "status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "informs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "container_type"
    t.integer "container_id"
    t.integer "status", limit: 1, default: 1
    t.integer "position", default: 1
    t.bigint "user_id", comment: "公告发布者"
    t.index ["user_id"], name: "index_informs_on_user_id"
  end

  create_table "innodb_monitor", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "a"
  end

  create_table "invite_lists", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "mail"
  end

  create_table "issue_categories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id", default: 0, null: false
    t.string "name", limit: 30, default: "", null: false
    t.integer "assigned_to_id"
    t.index ["assigned_to_id"], name: "index_issue_categories_on_assigned_to_id"
    t.index ["project_id"], name: "issue_categories_project_id"
  end

  create_table "issue_relations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "issue_from_id", null: false
    t.integer "issue_to_id", null: false
    t.string "relation_type", default: "", null: false
    t.integer "delay"
    t.index ["issue_from_id", "issue_to_id"], name: "index_issue_relations_on_issue_from_id_and_issue_to_id", unique: true
    t.index ["issue_from_id"], name: "index_issue_relations_on_issue_from_id"
    t.index ["issue_to_id"], name: "index_issue_relations_on_issue_to_id"
  end

  create_table "issue_statuses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", limit: 30, default: "", null: false
    t.boolean "is_closed", default: false, null: false
    t.boolean "is_default", default: false, null: false
    t.integer "position", default: 1
    t.integer "default_done_ratio"
    t.index ["is_closed"], name: "index_issue_statuses_on_is_closed"
    t.index ["is_default"], name: "index_issue_statuses_on_is_default"
    t.index ["position"], name: "index_issue_statuses_on_position"
  end

  create_table "issues", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "tracker_id", null: false
    t.integer "project_id", null: false
    t.string "subject", default: "", null: false
    t.text "description"
    t.date "due_date"
    t.integer "category_id"
    t.integer "status_id", null: false
    t.integer "assigned_to_id"
    t.integer "priority_id", null: false
    t.integer "fixed_version_id"
    t.integer "author_id", null: false
    t.integer "lock_version", default: 0, null: false
    t.datetime "created_on"
    t.datetime "updated_on"
    t.date "start_date"
    t.integer "done_ratio", default: 0, null: false
    t.float "estimated_hours"
    t.integer "parent_id"
    t.integer "root_id"
    t.integer "lft"
    t.integer "rgt"
    t.boolean "is_private", default: false, null: false
    t.datetime "closed_on"
    t.integer "project_issues_index"
    t.index ["assigned_to_id"], name: "index_issues_on_assigned_to_id"
    t.index ["author_id"], name: "index_issues_on_author_id"
    t.index ["category_id"], name: "index_issues_on_category_id"
    t.index ["created_on"], name: "index_issues_on_created_on"
    t.index ["fixed_version_id"], name: "index_issues_on_fixed_version_id"
    t.index ["priority_id"], name: "index_issues_on_priority_id"
    t.index ["project_id"], name: "issues_project_id"
    t.index ["root_id", "lft", "rgt"], name: "index_issues_on_root_id_and_lft_and_rgt"
    t.index ["status_id"], name: "index_issues_on_status_id"
    t.index ["tracker_id"], name: "index_issues_on_tracker_id"
  end

  create_table "item_analyses", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "item_bank_id"
    t.text "analysis"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["item_bank_id"], name: "index_item_analyses_on_item_bank_id"
  end

  create_table "item_bank_standard_answers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "position", comment: "表示选项的序号,并非外键,相同的position_id表示,同一个空的答案"
    t.integer "item_bank_id", comment: "外键,关联ItemBank"
    t.text "answer_text"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["item_bank_id"], name: "index_item_bank_standard_answers_on_item_bank_id"
  end

  create_table "item_bank_tag_repertoires", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "item_bank_id"
    t.bigint "tag_repertoire_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["item_bank_id"], name: "index_item_bank_tag_repertoires_on_item_bank_id"
    t.index ["tag_repertoire_id"], name: "index_item_bank_tag_repertoires_on_tag_repertoire_id"
  end

  create_table "item_banks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "name"
    t.integer "item_type"
    t.integer "difficulty", default: 1
    t.bigint "user_id"
    t.boolean "public", default: false
    t.integer "quotes", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "sub_discipline_id"
    t.integer "container_id"
    t.string "container_type"
    t.boolean "is_ordered", default: true
    t.integer "old_id"
    t.integer "copy_id"
    t.index ["user_id"], name: "index_item_banks_on_user_id"
  end

  create_table "item_baskets", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "item_bank_id"
    t.bigint "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "position", default: 0
    t.float "score", default: 0.0
    t.integer "item_type", default: 0
    t.integer "examination_intelligent_setting_id"
    t.index ["item_bank_id"], name: "index_item_baskets_on_item_bank_id"
    t.index ["user_id"], name: "index_item_baskets_on_user_id"
  end

  create_table "item_choices", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "item_bank_id"
    t.text "choice_text"
    t.boolean "is_answer"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["item_bank_id"], name: "index_item_choices_on_item_bank_id"
  end

  create_table "job_classifies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "parent_id", default: 0
    t.integer "position", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "jobs", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.bigint "job_classify_id"
    t.integer "num"
    t.integer "job_category"
    t.string "city"
    t.string "address"
    t.integer "min_salary"
    t.integer "max_salary"
    t.integer "education"
    t.integer "work_year"
    t.text "description"
    t.text "introduce"
    t.bigint "user_id"
    t.string "state"
    t.string "company"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "apply_jobs_count", default: 0
    t.index ["job_classify_id"], name: "index_jobs_on_job_classify_id"
    t.index ["user_id"], name: "index_jobs_on_user_id"
  end

  create_table "join_in_competitions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "competition_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "join_in_contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "bid_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "journal_details", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "journal_id", default: 0, null: false
    t.string "property", limit: 30, default: "", null: false
    t.string "prop_key", limit: 30, default: "", null: false
    t.text "old_value"
    t.text "value"
    t.index ["journal_id"], name: "journal_details_journal_id"
  end

  create_table "journal_replies", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "journal_id"
    t.integer "user_id"
    t.integer "reply_id"
    t.index ["journal_id"], name: "index_journal_replies_on_journal_id"
    t.index ["reply_id"], name: "index_journal_replies_on_reply_id"
    t.index ["user_id"], name: "index_journal_replies_on_user_id"
  end

  create_table "journals", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "journalized_id", default: 0, null: false
    t.string "journalized_type", limit: 30, default: "", null: false
    t.integer "user_id", default: 0, null: false
    t.text "notes"
    t.datetime "created_on", null: false
    t.boolean "private_notes", default: false, null: false
    t.integer "parent_id"
    t.integer "comments_count", default: 0
    t.integer "reply_id"
    t.index ["created_on"], name: "index_journals_on_created_on"
    t.index ["journalized_id", "journalized_type"], name: "journals_journalized_id"
    t.index ["journalized_id"], name: "index_journals_on_journalized_id"
    t.index ["user_id"], name: "index_journals_on_user_id"
  end

  create_table "journals_for_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "jour_id"
    t.string "jour_type"
    t.integer "user_id"
    t.text "notes"
    t.integer "status"
    t.integer "reply_id"
    t.datetime "created_on", null: false
    t.datetime "updated_on", null: false
    t.string "m_parent_id"
    t.boolean "is_readed"
    t.integer "m_reply_count"
    t.integer "m_reply_id"
    t.integer "is_comprehensive_evaluation"
    t.integer "private", default: 0
    t.integer "root_id"
    t.boolean "hidden", default: false
    t.integer "praises_count", default: 0
    t.index ["jour_id"], name: "index_journals_for_messages_on_jour_id"
    t.index ["root_id"], name: "index_journals_for_messages_on_root_id"
  end

  create_table "kindeditor_assets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "asset"
    t.integer "file_size"
    t.string "file_type"
    t.integer "owner_id"
    t.string "asset_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "owner_type", default: 0
  end

  create_table "knowledge_point_containers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "container_id"
    t.string "container_type"
    t.bigint "knowledge_point_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["knowledge_point_id"], name: "index_knowledge_point_containers_on_knowledge_point_id"
  end

  create_table "knowledge_points", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "curriculum_id"
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["curriculum_id"], name: "index_knowledge_points_on_curriculum_id"
  end

  create_table "laboratories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "school_id"
    t.string "identifier"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "sync_course", default: false
    t.boolean "sync_subject", default: false
    t.boolean "sync_shixun", default: false
    t.index ["identifier"], name: "index_laboratories_on_identifier", unique: true
    t.index ["school_id"], name: "index_laboratories_on_school_id"
  end

  create_table "laboratory_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "laboratory_id"
    t.text "config"
    t.index ["laboratory_id"], name: "index_laboratory_settings_on_laboratory_id"
  end

  create_table "laboratory_shixuns", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "laboratory_id"
    t.bigint "shixun_id"
    t.boolean "ownership", default: false
    t.boolean "homepage", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["laboratory_id"], name: "index_laboratory_shixuns_on_laboratory_id"
    t.index ["shixun_id"], name: "index_laboratory_shixuns_on_shixun_id"
  end

  create_table "laboratory_subjects", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "laboratory_id"
    t.bigint "subject_id"
    t.boolean "ownership", default: false
    t.boolean "homepage", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["laboratory_id"], name: "index_laboratory_subjects_on_laboratory_id"
    t.index ["subject_id"], name: "index_laboratory_subjects_on_subject_id"
  end

  create_table "laboratory_users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "laboratory_id"
    t.bigint "user_id"
    t.index ["laboratory_id"], name: "index_laboratory_users_on_laboratory_id"
    t.index ["user_id"], name: "index_laboratory_users_on_user_id"
  end

  create_table "libraries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "title"
    t.text "content"
    t.string "uuid"
    t.string "status"
    t.integer "visited_count", default: 0
    t.datetime "published_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "author_name"
    t.string "author_school_name"
    t.integer "cover_id"
    t.integer "praises_count", default: 0
    t.bigint "laboratory_id"
    t.index ["laboratory_id"], name: "index_libraries_on_laboratory_id"
    t.index ["published_at"], name: "index_libraries_on_published_at"
  end

  create_table "library_applies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "library_id"
    t.string "status"
    t.string "reason"
    t.datetime "refused_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["refused_at"], name: "index_library_applies_on_refused_at"
  end

  create_table "library_library_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "library_id"
    t.integer "library_tag_id"
  end

  create_table "library_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
  end

  create_table "live_links", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_id"
    t.bigint "user_id"
    t.string "url"
    t.text "description"
    t.boolean "on_status", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "course_name"
    t.string "platform"
    t.datetime "live_time"
    t.integer "duration"
    t.index ["course_id"], name: "index_live_links_on_course_id"
    t.index ["user_id"], name: "index_live_links_on_user_id"
  end

  create_table "local_challenge_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "local_challenge_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "local_challenges", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "local_shixun_id"
    t.string "subject"
    t.integer "status"
    t.integer "position"
    t.text "task_pass"
    t.text "answer"
    t.integer "score"
    t.integer "visits"
    t.string "path"
    t.integer "evaluation_way"
    t.integer "difficulty"
    t.string "exec_path"
    t.integer "code_line"
    t.integer "st"
    t.text "web_route"
    t.text "picture_path"
    t.text "expect_picture_path"
    t.integer "challenge_tags_count"
    t.datetime "modify_time"
    t.string "original_picture_path"
    t.integer "show_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "test_set_score"
  end

  create_table "local_mirror_repositories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "local_shixun_id"
    t.integer "mirror_repository_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "type_name"
  end

  create_table "local_shixun_tag_repertoires", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "tag_repertoire_id"
    t.integer "local_shixun_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "local_shixuns", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "user_id"
    t.integer "gpid"
    t.integer "visits"
    t.integer "status"
    t.string "language"
    t.text "authentication"
    t.string "identifier"
    t.text "propaedeutics"
    t.integer "trainee"
    t.integer "major_id"
    t.integer "webssh"
    t.boolean "homepage_show"
    t.boolean "hidden"
    t.integer "fork_from"
    t.boolean "can_copy"
    t.datetime "modifiy_tim"
    t.datetime "reset_time"
    t.integer "closer_id"
    t.datetime "end_time"
    t.string "git_url"
    t.boolean "vnc"
    t.integer "myshixuns_count"
    t.integer "challenges_count"
    t.integer "use_scope"
    t.text "evaluate_script"
    t.integer "mirror_script_id"
    t.string "image_text"
    t.boolean "code_hidden"
    t.boolean "task_pass"
    t.integer "exec_time"
    t.string "test_set_permission"
    t.boolean "sigle_training"
    t.boolean "hide_code"
    t.boolean "multi_webssh"
    t.integer "excute_time"
    t.integer "averge_star"
    t.integer "forbid_copy"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "shixun_id"
    t.string "local_giturl"
  end

  create_table "local_stage_shixuns", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "subject_id"
    t.integer "local_subject_id"
    t.integer "stage_id"
    t.integer "local_stage_id"
    t.integer "shixun_id"
    t.integer "local_shixun_id"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "local_stages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "subject_id"
    t.string "name"
    t.text "description"
    t.integer "position"
    t.integer "shixuns_count"
    t.integer "local_subject_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "local_subjects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "status"
    t.text "learning_notes"
    t.string "introduction"
    t.integer "stages_count"
    t.integer "stage_shixuns_count"
    t.integer "shixuns_count"
    t.integer "subject_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "local_test_sets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "input"
    t.text "output"
    t.integer "local_challenge_id"
    t.integer "is_public"
    t.integer "result"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "score"
  end

  create_table "major_courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_list_id"
    t.integer "major_id"
    t.index ["course_list_id"], name: "index_major_courses_on_course_list_id"
    t.index ["major_id"], name: "index_major_courses_on_major_id"
  end

  create_table "majors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "major_code"
    t.string "name"
    t.integer "first_level_discipline_id"
    t.integer "discipline_category_id"
    t.integer "major_level"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.boolean "support_shixuns", default: false
    t.index ["discipline_category_id"], name: "index_majors_on_discipline_category_id"
    t.index ["first_level_discipline_id"], name: "index_majors_on_first_level_discipline_id"
  end

  create_table "mark_downs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "member_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "member_id", null: false
    t.integer "role_id", null: false
    t.integer "inherited_from"
    t.integer "is_current", default: 1
    t.index ["member_id"], name: "index_member_roles_on_member_id"
    t.index ["role_id"], name: "index_member_roles_on_role_id"
  end

  create_table "members", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", default: 0, null: false
    t.integer "project_id", default: 0
    t.datetime "created_on"
    t.boolean "mail_notification", default: false, null: false
    t.integer "course_id", default: -1
    t.integer "course_group_id", default: 0
    t.integer "is_collect", default: 1
    t.integer "graduation_group_id", default: 0
    t.index ["course_id"], name: "index_members_on_course_id"
    t.index ["project_id"], name: "index_members_on_project_id"
    t.index ["user_id", "project_id", "course_id"], name: "index_members_on_user_id_and_project_id", unique: true
    t.index ["user_id"], name: "index_members_on_user_id"
  end

  create_table "memo_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "forum_id"
    t.integer "memo_id"
    t.string "memo_type"
    t.integer "viewed"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["memo_id", "memo_type"], name: "index_memo_messages_on_memo_id_and_memo_type"
    t.index ["user_id", "forum_id", "created_at"], name: "index_memo_messages_on_user_id_and_forum_id_and_created_at"
  end

  create_table "memo_tag_repertoires", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "memo_id"
    t.integer "tag_repertoire_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["memo_id"], name: "index_memo_tag_repertoires_on_memo_id"
    t.index ["tag_repertoire_id"], name: "index_memo_tag_repertoires_on_tag_repertoire_id"
  end

  create_table "memos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "forum_id", null: false
    t.integer "parent_id"
    t.string "subject", null: false
    t.text "content", limit: 4294967295, null: false
    t.integer "author_id", null: false
    t.integer "replies_count", default: 0
    t.integer "last_reply_id"
    t.boolean "lock", default: false
    t.boolean "sticky", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "viewed_count", default: 0
    t.integer "root_id"
    t.integer "reward"
    t.string "language"
    t.integer "hidden", limit: 1, default: 0
    t.string "repertoire_name"
    t.boolean "is_md", default: true
    t.integer "all_replies_count", default: 0
    t.integer "praises_count", default: 0
    t.index ["root_id"], name: "index_memos_on_root_id"
  end

  create_table "message_alls", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "message_id"
    t.string "message_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["message_type"], name: "index_message_alls_on_message_type"
    t.index ["user_id", "message_id", "created_at"], name: "index_message_alls_on_user_id_and_message_id_and_created_at"
  end

  create_table "message_details", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "content", limit: 4294967295
    t.integer "message_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["message_id"], name: "index_message_details_on_message_id"
  end

  create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "board_id", null: false
    t.integer "parent_id"
    t.string "subject", default: "", null: false
    t.integer "author_id"
    t.integer "replies_count", default: 0, null: false
    t.integer "last_reply_id"
    t.datetime "created_on", null: false
    t.datetime "updated_on", null: false
    t.boolean "locked", default: false
    t.integer "sticky", default: 0
    t.integer "reply_id"
    t.integer "quotes"
    t.integer "status", default: 0
    t.integer "root_id"
    t.integer "visits", default: 0
    t.integer "praises_count", default: 0
    t.boolean "is_hidden", default: false
    t.boolean "is_public", default: false
    t.integer "descendants_count", default: 0
    t.boolean "is_md", default: true
    t.boolean "email_notify", default: false
    t.index ["board_id"], name: "messages_board_id"
    t.index ["last_reply_id"], name: "index_messages_on_last_reply_id"
    t.index ["parent_id"], name: "messages_parent_id"
  end

  create_table "mirror_migrate_errors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.text "game_info"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "mirror_operation_records", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "mirror_repository_id"
    t.text "mirror_id"
    t.text "mirror_name"
    t.integer "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "user_id"
    t.string "old_tag"
    t.string "new_tag"
  end

  create_table "mirror_repositories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "mirrorID"
    t.string "name"
    t.string "main_type"
    t.text "description"
    t.integer "status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "type_name"
    t.text "script_template", limit: 4294967295
    t.integer "resource_limit", default: 10000
    t.integer "memory_limit", default: 1024
    t.integer "cpu_limit", limit: 1, default: 1
    t.integer "time_limit", default: 120
    t.boolean "should_compile"
    t.integer "repertoire_id"
    t.integer "sub_repertoire_id"
  end

  create_table "mirror_repository_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "mirror_type_id"
    t.integer "mirror_repository_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["mirror_repository_id"], name: "index_mirror_repository_types_on_mirror_repository_id"
    t.index ["mirror_type_id"], name: "index_mirror_repository_types_on_mirror_type_id"
  end

  create_table "mirror_scripts", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "mirror_repository_id"
    t.text "script", limit: 4294967295
    t.string "script_type"
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "mirror_types", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "mirror_update_records", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "mirror_repository_id"
    t.string "oldName"
    t.string "newName"
    t.string "oldType"
    t.string "newType"
    t.text "oldTag"
    t.text "newTag"
    t.text "oldDescription"
    t.text "newDescription"
    t.integer "oldStatus"
    t.integer "newStatus"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["mirror_repository_id"], name: "index_mirror_update_records_on_mirror_repository_id"
    t.index ["user_id"], name: "index_mirror_update_records_on_user_id"
  end

  create_table "module_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "module_type"
    t.string "property"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["module_type"], name: "index_module_settings_on_module_type"
  end

  create_table "mul_tests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "container_id"
    t.string "container_type"
    t.string "action"
    t.integer "time"
    t.integer "status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "language"
    t.integer "num"
    t.string "indentifier"
    t.string "name"
    t.integer "shixun_id"
  end

  create_table "myshixun_members", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "myshixun_id"
    t.integer "user_id"
    t.integer "role"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "myshixuns", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.boolean "is_public", default: true
    t.integer "user_id"
    t.integer "gpid"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "status", default: 0
    t.string "identifier"
    t.string "commit_id"
    t.datetime "modify_time"
    t.datetime "reset_time"
    t.boolean "system_tip", default: false
    t.string "git_url"
    t.datetime "onclick_time"
    t.string "repo_name"
    t.index ["identifier"], name: "index_myshixuns_on_identifier"
    t.index ["user_id", "shixun_id"], name: "index_myshixuns_on_user_id_and_shixun_id", unique: true
  end

  create_table "news", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.string "title", limit: 60, default: "", null: false
    t.string "summary", default: ""
    t.text "description"
    t.integer "author_id", default: 0, null: false
    t.datetime "created_on"
    t.integer "comments_count", default: 0, null: false
    t.integer "course_id"
    t.integer "sticky", default: 0
    t.integer "org_subfield_id"
    t.integer "contest_id"
    t.index ["author_id"], name: "index_news_on_author_id"
    t.index ["created_on"], name: "index_news_on_created_on"
    t.index ["project_id"], name: "news_project_id"
  end

  create_table "no_uses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", null: false
    t.string "no_use_type"
    t.integer "no_use_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "notificationcomments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "notificationcommented_type"
    t.integer "notificationcommented_id"
    t.integer "author_id"
    t.text "notificationcomments"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "oauth_configs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "client_id"
    t.string "client_secret"
    t.string "redirect_uri"
    t.string "scope"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "oauths", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "client_id"
    t.string "client_secret"
    t.string "code"
    t.string "redirect_uri"
    t.string "scope"
    t.string "access_token"
    t.string "refresh_token"
    t.integer "token_created_at"
    t.integer "token_expires_in"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "user_id", default: 0
    t.index ["user_id"], name: "index_oauths_on_user_id"
  end

  create_table "old_message_details", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "content", limit: 4294967295
    t.integer "message_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["message_id"], name: "index_message_details_on_message_id"
  end

  create_table "onclick_times", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.datetime "onclick_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_onclick_times_on_user_id"
  end

  create_table "open_id_authentication_associations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "issued"
    t.integer "lifetime"
    t.string "handle"
    t.string "assoc_type"
    t.binary "server_url"
    t.binary "secret"
  end

  create_table "open_id_authentication_nonces", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "timestamp", null: false
    t.string "server_url"
    t.string "salt", null: false
  end

  create_table "open_source_projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "commit_count", default: 0
    t.integer "code_line", default: 0
    t.integer "users_count", default: 0
    t.date "last_commit_time"
    t.string "url"
    t.date "date_collected"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "open_users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.string "type"
    t.string "uid"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "extra"
    t.index ["type", "uid"], name: "index_open_users_on_type_and_uid", unique: true
    t.index ["user_id"], name: "index_open_users_on_user_id"
  end

  create_table "openis", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "openi_user_id"
    t.string "login"
    t.string "avatar_url"
    t.string "name"
    t.string "email"
    t.integer "allow"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "option_numbers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "memo"
    t.integer "messages_for_issues"
    t.integer "issues_status"
    t.integer "replay_for_message"
    t.integer "replay_for_memo"
    t.integer "follow"
    t.integer "tread"
    t.integer "praise_by_one"
    t.integer "praise_by_two"
    t.integer "praise_by_three"
    t.integer "tread_by_one"
    t.integer "tread_by_two"
    t.integer "tread_by_three"
    t.integer "changeset"
    t.integer "document"
    t.integer "attachment"
    t.integer "issue_done_ratio"
    t.integer "post_issue"
    t.integer "score_type"
    t.integer "total_score"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "project_id"
  end

  create_table "org_activities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "org_act_id"
    t.string "org_act_type"
    t.integer "container_id"
    t.string "container_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "org_courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "organization_id"
    t.integer "course_id"
    t.datetime "created_at"
  end

  create_table "org_document_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "title"
    t.text "content"
    t.integer "organization_id"
    t.integer "creator_id"
    t.integer "parent_id"
    t.integer "reply_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "locked", default: false
    t.integer "sticky", default: 0
    t.integer "org_subfield_id"
    t.integer "status", default: 0
    t.integer "root_id"
    t.index ["root_id"], name: "index_org_document_comments_on_root_id"
  end

  create_table "org_member_roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "org_member_id"
    t.integer "role_id"
  end

  create_table "org_members", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "organization_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "org_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "sender_id"
    t.integer "organization_id"
    t.string "message_type"
    t.integer "message_id"
    t.integer "viewed"
    t.string "content"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "status", default: 0
  end

  create_table "org_projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "organization_id"
    t.integer "project_id"
    t.datetime "created_at"
  end

  create_table "org_subfield_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "org_subfield_id"
    t.integer "message_id"
    t.string "message_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "org_subfields", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "organization_id"
    t.integer "priority"
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "field_type"
    t.integer "hide", default: 0
    t.integer "status", default: 1
  end

  create_table "organizations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "creator_id"
    t.integer "home_id"
    t.boolean "is_public"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "allow_guest_download", default: true
    t.integer "visits", default: 0
    t.integer "show_mode", default: 0
    t.integer "allow_teacher", default: 0
  end

  create_table "outputs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "code"
    t.integer "game_id"
    t.text "msg"
    t.text "out_put", limit: 4294967295
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "test_set_position"
    t.text "actual_output", limit: 4294967295
    t.boolean "result"
    t.boolean "is_public"
    t.integer "query_index", default: 1
    t.integer "compile_success", default: 1
    t.string "text_scor"
    t.string "sec_key"
    t.float "ts_mem"
    t.float "ts_time"
    t.index ["game_id", "query_index"], name: "game"
  end

  create_table "partner_customers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "partner_id"
    t.integer "customer_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "partner_manager_groups", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "partner_id"
    t.string "name"
    t.boolean "admin", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["partner_id"], name: "index_partner_manager_groups_on_partner_id"
  end

  create_table "partner_managers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "partner_id"
    t.bigint "partner_manager_group_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["partner_id"], name: "index_partner_managers_on_partner_id"
    t.index ["partner_manager_group_id"], name: "index_partner_managers_on_partner_manager_group_id"
    t.index ["user_id"], name: "index_partner_managers_on_user_id"
  end

  create_table "partner_managers_groups", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "partner_id", null: false
    t.string "name", null: false
    t.boolean "admin", default: false, null: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "partners", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "school_id"
  end

  create_table "phone_app_versions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "version"
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "platform_samples", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "samples_type"
    t.text "contents"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "poll_answers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "poll_question_id"
    t.text "answer_text"
    t.integer "answer_position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["poll_question_id"], name: "index_poll_answers_on_poll_question_id"
  end

  create_table "poll_group_settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "poll_id"
    t.integer "course_group_id"
    t.integer "course_id"
    t.datetime "publish_time"
    t.datetime "end_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_group_id"], name: "index_poll_group_settings_on_course_group_id"
    t.index ["course_id"], name: "index_poll_group_settings_on_course_id"
    t.index ["poll_id"], name: "index_poll_group_settings_on_poll_id"
  end

  create_table "poll_questions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "question_title"
    t.integer "question_type"
    t.integer "is_necessary"
    t.integer "poll_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "question_number"
    t.integer "max_choices", default: 0
    t.integer "min_choices", default: 0
    t.index ["poll_id"], name: "index_poll_questions_on_poll_id"
  end

  create_table "poll_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "poll_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "commit_status", default: 0
    t.datetime "start_at"
    t.datetime "end_at"
    t.boolean "is_delete", default: false
    t.index ["poll_id", "user_id"], name: "index_poll_id_and_user_id", unique: true
  end

  create_table "poll_votes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "poll_question_id", default: -1
    t.integer "poll_answer_id"
    t.text "vote_text"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["poll_question_id", "user_id", "poll_answer_id"], name: "poll_answer_index", unique: true
  end

  create_table "polls", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "polls_name"
    t.string "polls_type"
    t.integer "course_id"
    t.integer "polls_status", default: 1
    t.integer "user_id"
    t.datetime "publish_time"
    t.datetime "end_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "polls_description"
    t.integer "show_result", default: 0
    t.integer "exercise_bank_id"
    t.boolean "is_public", default: false
    t.boolean "unified_setting", default: true
    t.boolean "un_anonymous", default: false
    t.index ["course_id"], name: "index_polls_on_course_id"
  end

  create_table "portal_images", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "position"
    t.string "link"
    t.boolean "status", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.bigint "laboratory_id"
    t.index ["laboratory_id"], name: "index_portal_images_on_laboratory_id"
  end

  create_table "praise_tread_caches", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "object_id", null: false
    t.string "object_type"
    t.integer "praise_num"
    t.integer "tread_num"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "praise_treads", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", null: false
    t.integer "praise_tread_object_id"
    t.string "praise_tread_object_type"
    t.integer "praise_or_tread", default: 1
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["praise_tread_object_id", "praise_tread_object_type"], name: "praise_tread"
  end

  create_table "principal_activities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "principal_id"
    t.integer "principal_act_id"
    t.string "principal_act_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "private_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "target_id"
    t.integer "sender_id"
    t.integer "receiver_id"
    t.text "content"
    t.datetime "send_time"
    t.integer "status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_private_messages_on_user_id"
  end

  create_table "professional_levels", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "level"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "program_bank_tests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "input"
    t.text "output"
    t.boolean "test_type"
    t.integer "homework_bank_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "program_banks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "name"
    t.text "description"
    t.integer "homework_type"
    t.integer "quotes", default: 0
    t.boolean "is_public"
    t.string "language"
    t.text "standard_code", limit: 4294967295
    t.integer "min_num"
    t.integer "max_num"
    t.boolean "base_on_project"
    t.string "applicable_syllabus"
    t.integer "homework_common_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "project_infos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "project_package_applies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_package_id"
    t.string "status"
    t.string "reason"
    t.datetime "refused_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["project_package_id"], name: "index_project_package_applies_on_project_package_id"
  end

  create_table "project_package_categories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "position"
  end

  create_table "project_packages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "creator_id"
    t.string "status"
    t.string "title"
    t.text "content"
    t.string "contact_name"
    t.string "contact_phone"
    t.decimal "min_price", precision: 10
    t.decimal "max_price", precision: 10
    t.integer "visit_count", default: 0
    t.integer "bidding_users_count", default: 0
    t.datetime "deadline_at"
    t.datetime "published_at"
    t.datetime "bidding_finished_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "project_package_category_id"
    t.index ["creator_id"], name: "index_project_packages_on_creator_id"
    t.index ["published_at"], name: "index_project_packages_on_published_at"
  end

  create_table "project_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "project_id"
    t.integer "score"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "issue_num", default: 0
    t.integer "issue_journal_num", default: 0
    t.integer "news_num", default: 0
    t.integer "documents_num", default: 0
    t.integer "changeset_num", default: 0
    t.integer "board_message_num", default: 0
    t.integer "board_num", default: 0
    t.integer "attach_num", default: 0
    t.datetime "commit_time"
    t.integer "pull_request_num", default: 0
  end

  create_table "project_statuses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "changesets_count"
    t.integer "watchers_count"
    t.integer "project_id"
    t.integer "project_type"
    t.float "grade", default: 0.0
    t.integer "course_ac_para", default: 0
    t.index ["grade"], name: "index_project_statuses_on_grade"
  end

  create_table "projecting_softapplictions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "softapplication_id"
    t.integer "project_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", default: "", null: false
    t.text "description"
    t.string "homepage", default: ""
    t.boolean "is_public", default: true, null: false
    t.integer "parent_id"
    t.datetime "created_on"
    t.datetime "updated_on"
    t.string "identifier"
    t.integer "status", default: 1, null: false
    t.integer "lft"
    t.integer "rgt"
    t.boolean "inherit_members", default: false, null: false
    t.integer "project_type"
    t.boolean "hidden_repo", default: false, null: false
    t.integer "attachmenttype", default: 1
    t.integer "user_id"
    t.integer "dts_test", default: 0
    t.string "enterprise_name"
    t.integer "organization_id"
    t.integer "project_new_type"
    t.integer "gpid"
    t.integer "forked_from_project_id"
    t.integer "forked_count"
    t.integer "publish_resource", default: 0
    t.integer "visits", default: 0
    t.integer "hot", default: 0
    t.string "invite_code"
    t.string "qrcode"
    t.integer "qrcode_expiretime", default: 0
    t.text "script"
    t.integer "training_status", limit: 1, default: 0
    t.string "rep_identifier"
    t.index ["lft"], name: "index_projects_on_lft"
    t.index ["rgt"], name: "index_projects_on_rgt"
  end

  create_table "projects_trackers", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id", default: 0, null: false
    t.integer "tracker_id", default: 0, null: false
    t.index ["project_id", "tracker_id"], name: "projects_trackers_unique", unique: true
    t.index ["project_id"], name: "projects_trackers_project_id"
  end

  create_table "pull_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "pull_request_id"
    t.integer "gpid"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "status", default: 0
    t.integer "project_id"
    t.string "title"
  end

  create_table "quality_analyses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.string "author_login"
    t.string "rep_identifier"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "sonar_version", default: 0
    t.string "path"
    t.string "branch"
    t.string "language"
    t.string "sonar_name"
  end

  create_table "queries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.string "name", default: "", null: false
    t.text "filters"
    t.integer "user_id", default: 0, null: false
    t.boolean "is_public", default: false, null: false
    t.text "column_names"
    t.text "sort_criteria"
    t.string "group_by"
    t.string "type"
    t.index ["project_id"], name: "index_queries_on_project_id"
    t.index ["user_id"], name: "index_queries_on_user_id"
  end

  create_table "question_banks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "name"
    t.integer "container_id"
    t.string "container_type"
    t.integer "quotes"
    t.integer "user_id"
    t.boolean "is_public"
    t.integer "course_list_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "reference_materials", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "book"
    t.string "editor"
    t.string "press"
    t.integer "syllabus_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["syllabus_id"], name: "index_reference_materials_on_syllabus_id"
  end

  create_table "relationships", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "follower_id"
    t.integer "followed_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["followed_id"], name: "index_relationships_on_followed_id"
    t.index ["follower_id", "followed_id"], name: "index_relationships_on_follower_id_and_followed_id", unique: true
    t.index ["follower_id"], name: "index_relationships_on_follower_id"
  end

  create_table "relative_memo_to_open_source_projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "osp_id"
    t.integer "relative_memo_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "relative_memos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "osp_id"
    t.integer "parent_id"
    t.string "subject", null: false
    t.text "content", limit: 16777215, null: false
    t.integer "author_id"
    t.integer "replies_count", default: 0
    t.integer "last_reply_id"
    t.boolean "lock", default: false
    t.boolean "sticky", default: false
    t.boolean "is_quote", default: false
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "viewed_count_crawl", default: 0
    t.integer "viewed_count_local", default: 0
    t.string "url"
    t.string "username"
    t.string "userhomeurl"
    t.date "date_collected"
    t.string "topic_resource"
  end

  create_table "rep_statics", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.integer "commits_num"
    t.string "uname"
    t.string "email"
    t.integer "add"
    t.integer "del"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "changeset"
  end

  create_table "repertoires", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "repositories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id", default: 0, null: false
    t.string "url", default: "", null: false
    t.string "login", limit: 60, default: ""
    t.string "password", default: ""
    t.string "root_url", default: ""
    t.string "type"
    t.string "path_encoding", limit: 64
    t.string "log_encoding", limit: 64
    t.text "extra_info"
    t.string "identifier"
    t.boolean "is_default", default: false
    t.boolean "hidden", default: false
    t.integer "shixun_id"
    t.integer "myshixun_id"
    t.index ["project_id"], name: "index_repositories_on_project_id"
  end

  create_table "resource_banks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "course_id"
    t.integer "attachment_id"
    t.string "filename"
    t.string "disk_filename"
    t.integer "filesize"
    t.string "digest"
    t.integer "downloads"
    t.integer "user_id"
    t.text "description"
    t.string "disk_directory"
    t.boolean "is_public"
    t.integer "copy_from"
    t.integer "quotes"
    t.string "applicable_syllabus"
    t.integer "major_level"
    t.integer "discipline_category_id"
    t.integer "first_level_discipline_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "content_type"
    t.index ["course_id"], name: "index_resource_banks_on_course_id"
    t.index ["user_id"], name: "index_resource_banks_on_user_id"
  end

  create_table "resumes", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.string "name"
    t.integer "sex"
    t.date "birth_on"
    t.date "job_year"
    t.string "mobile"
    t.text "job_position"
    t.text "city"
    t.integer "salary"
    t.string "job_category"
    t.text "experience"
    t.text "education"
    t.text "evaluate"
    t.boolean "attachmentable"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_resumes_on_user_id"
  end

  create_table "rich_rich_files", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "rich_file_file_name"
    t.string "rich_file_content_type"
    t.integer "rich_file_file_size"
    t.datetime "rich_file_updated_at"
    t.string "owner_type"
    t.integer "owner_id"
    t.text "uri_cache"
    t.string "simplified_type", default: "file"
  end

  create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", limit: 30, default: "", null: false
    t.integer "position", default: 1
    t.boolean "assignable", default: true
    t.integer "builtin", default: 0, null: false
    t.text "permissions"
    t.string "issues_visibility", limit: 30, default: "default", null: false
  end

  create_table "run_code_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "status"
    t.string "message"
    t.integer "game_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["game_id"], name: "index_run_code_messages_on_game_id"
  end

  create_table "salesman_channels", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "salesman_id"
    t.bigint "school_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["salesman_id", "school_id"], name: "index_salesman_channels_on_salesman_id_and_school_id", unique: true
    t.index ["salesman_id"], name: "index_salesman_channels_on_salesman_id"
    t.index ["school_id"], name: "index_salesman_channels_on_school_id"
  end

  create_table "salesman_customers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "salesman_id"
    t.bigint "user_id"
    t.bigint "school_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["salesman_id", "user_id"], name: "index_salesman_customers_on_salesman_id_and_user_id", unique: true
    t.index ["salesman_id"], name: "index_salesman_customers_on_salesman_id"
    t.index ["school_id"], name: "index_salesman_customers_on_school_id"
    t.index ["user_id"], name: "index_salesman_customers_on_user_id"
  end

  create_table "salesmans", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.string "name"
    t.integer "salesman_channels_count"
    t.integer "salesman_customers_count"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_salesmans_on_user_id"
  end

  create_table "salesmen", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.string "name"
    t.integer "salesman_channels_count"
    t.integer "salesman_customers_count"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_salesmen_on_user_id"
  end

  create_table "school_daily_active_users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "school_daily_report_id"
    t.integer "user_id"
    t.index ["school_daily_report_id"], name: "index_school_daily_active_users_on_school_daily_report_id"
  end

  create_table "school_daily_reports", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "school_id"
    t.string "school_name"
    t.integer "teacher_increase_count"
    t.integer "student_increase_count"
    t.integer "course_increase_count"
    t.integer "shixun_increase_count"
    t.integer "active_user_count"
    t.date "date"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "shixun_homework_count", default: 0
    t.integer "shixun_evaluate_count", default: 0
    t.index ["date", "active_user_count"], name: "index_school_daily_reports_on_date_and_active_user_count"
    t.index ["date", "course_increase_count"], name: "index_school_daily_reports_on_date_and_course_increase_count"
    t.index ["date", "shixun_increase_count"], name: "index_school_daily_reports_on_date_and_shixun_increase_count"
    t.index ["date", "student_increase_count"], name: "index_school_daily_reports_on_date_and_student_increase_count"
    t.index ["date", "teacher_increase_count"], name: "index_school_daily_reports_on_date_and_teacher_increase_count"
    t.index ["school_id", "date"], name: "index_school_daily_reports_on_school_id_and_date", unique: true
  end

  create_table "school_images", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "position"
    t.string "link"
    t.boolean "status", default: false
    t.integer "school_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "school_reports", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "school_id"
    t.string "school_name"
    t.integer "shixun_evaluate_count"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "student_work_count", default: 0
    t.index ["school_id"], name: "index_school_reports_on_school_id"
    t.index ["shixun_evaluate_count"], name: "index_school_reports_on_shixun_evaluate_count"
  end

  create_table "schools", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "province"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "logo_link"
    t.string "pinyin"
    t.integer "school_type", default: 0
    t.string "city"
    t.string "address"
    t.boolean "auto_users_trial", default: false
    t.string "shool_code"
    t.datetime "authorization_time"
    t.integer "ec_auth", limit: 1, default: 0
    t.string "identifier"
    t.boolean "is_online", default: false
    t.string "video_name"
    t.string "video_desc"
    t.string "course_link"
    t.string "course_name"
    t.integer "partner_id"
    t.integer "customer_id"
    t.index ["customer_id"], name: "index_schools_on_customer_id"
    t.index ["identifier"], name: "index_schools_on_identifier"
    t.index ["partner_id"], name: "index_schools_on_partner_id"
  end

  create_table "score_indicator_qualities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.float "upper_limit"
    t.float "lower_limit"
    t.integer "score_set_id"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "score_indicators", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "description"
    t.integer "score_set_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "scale"
  end

  create_table "score_quality_descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "score_indicator_id"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "score_sets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "secdomains", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "sub_type"
    t.string "subname"
    t.integer "pid", default: 0
    t.string "desc"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "seems_rateable_cached_ratings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "cacheable_id"
    t.string "cacheable_type"
    t.float "avg", null: false
    t.integer "cnt", null: false
    t.string "dimension"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "seems_rateable_rates", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "rater_id"
    t.integer "rateable_id"
    t.string "rateable_type"
    t.float "stars", null: false
    t.string "dimension"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "is_teacher_score", default: 0
  end

  create_table "settings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", default: "", null: false
    t.text "value"
    t.datetime "updated_on"
    t.index ["name"], name: "index_settings_on_name"
  end

  create_table "shares", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.date "created_on"
    t.string "url"
    t.string "title"
    t.integer "share_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "project_id"
    t.integer "user_id"
    t.string "description"
  end

  create_table "shield_activities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "container_type"
    t.integer "container_id"
    t.string "shield_type"
    t.integer "shield_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "shield_wechat_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "container_id"
    t.string "container_type"
    t.integer "shield_id"
    t.string "shield_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "shixun_infos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "propaedeutics", limit: 4294967295
    t.text "description", limit: 4294967295
    t.text "evaluate_script", limit: 4294967295
    t.integer "shixun_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "fork_reason"
    t.index ["shixun_id"], name: "index_shixun_infos_on_shixun_id", unique: true
  end

  create_table "shixun_major_courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.integer "course_list_id"
    t.integer "major_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["major_id"], name: "index_shixun_major_courses_on_major_id"
    t.index ["shixun_id"], name: "index_shixun_major_courses_on_shixun_id"
  end

  create_table "shixun_members", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "shixun_id"
    t.integer "role"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id"], name: "index_shixun_members_on_shixun_id"
    t.index ["user_id", "shixun_id"], name: "index_shixun_members_on_user_id_and_shixun_id", unique: true
  end

  create_table "shixun_mirror_repositories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.integer "mirror_repository_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id"], name: "index_shixun_mirror_repositories_on_shixun_id"
  end

  create_table "shixun_modifies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.integer "myshixun_id"
    t.integer "status", limit: 1, default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id", "myshixun_id"], name: "shixun_id_myshixun_id"
  end

  create_table "shixun_ports", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.integer "port"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "shixun_reviews", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "shixun_id"
    t.string "evaluate_content"
    t.integer "status"
    t.string "review_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id"], name: "index_shixun_reviews_on_shixun_id"
    t.index ["user_id"], name: "index_shixun_reviews_on_user_id"
  end

  create_table "shixun_schools", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.integer "school_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id"], name: "index_shixun_schools_on_shixun_id"
  end

  create_table "shixun_secret_repositories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "shixun_id"
    t.string "repo_name"
    t.string "secret_dir_path"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id"], name: "index_shixun_secret_repositories_on_shixun_id", unique: true
  end

  create_table "shixun_service_configs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.integer "cpu_limit", default: 1
    t.integer "memory_limit", default: 1024
    t.integer "request_limit", default: 10
    t.float "lower_cpu_limit", default: 0.1
    t.integer "resource_limit", default: 10000
    t.integer "mirror_repository_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id", "mirror_repository_id"], name: "shixun_id_mirror_id_unique", unique: true
  end

  create_table "shixun_tag_repertoires", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "shixun_id"
    t.integer "tag_repertoire_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id", "tag_repertoire_id"], name: "shixun_id_tag_repertoire_id"
  end

  create_table "shixun_work_comments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "student_work_id"
    t.integer "challenge_id", default: 0
    t.integer "user_id"
    t.text "comment"
    t.text "hidden_comment"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "batch_comment", default: false
    t.index ["challenge_id"], name: "index_shixun_work_comments_on_challenge_id"
    t.index ["student_work_id"], name: "index_shixun_work_comments_on_student_work_id"
    t.index ["user_id"], name: "index_shixun_work_comments_on_user_id"
  end

  create_table "shixuns", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "user_id"
    t.integer "gpid"
    t.integer "visits", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "status", default: 0
    t.string "language"
    t.boolean "authentication", default: false
    t.string "identifier"
    t.integer "trainee", default: 1
    t.integer "major_id"
    t.integer "webssh", default: 0
    t.boolean "homepage_show", default: false
    t.boolean "hidden", default: false
    t.integer "fork_from"
    t.boolean "can_copy", default: false
    t.datetime "modify_time"
    t.datetime "reset_time"
    t.datetime "publish_time"
    t.integer "closer_id"
    t.datetime "end_time"
    t.string "git_url"
    t.boolean "vnc", default: false
    t.integer "myshixuns_count", default: 0
    t.integer "challenges_count", default: 0
    t.integer "use_scope", limit: 1, default: 0
    t.integer "mirror_script_id"
    t.string "image_text", limit: 60
    t.boolean "code_hidden", default: false
    t.boolean "task_pass", default: true
    t.integer "exec_time", default: 20
    t.boolean "test_set_permission", default: true
    t.boolean "sigle_training", default: false
    t.boolean "hide_code", default: false
    t.boolean "multi_webssh", default: false
    t.integer "excute_time"
    t.string "repo_name"
    t.float "averge_star", default: 5.0
    t.datetime "opening_time"
    t.integer "users_count", default: 0
    t.boolean "forbid_copy", default: false
    t.integer "pod_life", default: 0
    t.boolean "vnc_evaluate", default: false
    t.boolean "code_edit_permission", default: false
    t.integer "laboratory_id"
    t.boolean "vip", default: false
    t.boolean "is_jupyter", default: false
    t.integer "public", default: 0
    t.boolean "is_wechat_support", default: false
    t.boolean "to_be_built", default: false
    t.integer "prebuild_click_count", default: 0
    t.index ["identifier"], name: "index_shixuns_on_identifier"
    t.index ["user_id"], name: "index_shixuns_on_user_id"
  end

  create_table "softapplications", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "app_type_id"
    t.string "app_type_name"
    t.string "android_min_version_available"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "contest_id"
    t.integer "softapplication_id"
    t.integer "is_public"
    t.string "application_developers"
    t.string "deposit_project_url"
    t.string "deposit_project"
    t.integer "project_id"
  end

  create_table "sonar_errors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.string "jenkins_job_name"
    t.text "output"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "ssos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "openid"
    t.string "name"
    t.string "password"
    t.string "email"
    t.integer "sex"
    t.string "school"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_ssos_on_user_id"
  end

  create_table "sta_alls", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "school_id", default: 0
    t.integer "tea_count", default: 0
    t.integer "stu_count", default: 0
    t.integer "active_users_count", default: 0
    t.integer "courses_count", default: 0
    t.integer "curr_courses_count", default: 0
    t.integer "homw_shixuns_count", default: 0
    t.integer "homw_other_count", default: 0
    t.integer "sources_count", default: 0
    t.integer "videos_count", default: 0
    t.integer "shixuns_count", default: 0
    t.integer "myshixuns_count", default: 0
    t.integer "mys_passed_count", default: 0
    t.integer "games_count", default: 0
    t.integer "games_passed_count", default: 0
    t.integer "build_count", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["school_id"], name: "index_sta_alls_on_school_id", unique: true
  end

  create_table "stage_shixuns", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "subject_id"
    t.integer "stage_id"
    t.integer "shixun_id"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id"], name: "index_stage_shixuns_on_shixun_id"
    t.index ["stage_id"], name: "index_stage_shixuns_on_stage_id"
    t.index ["subject_id"], name: "index_stage_shixuns_on_subject_id"
  end

  create_table "stages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "subject_id"
    t.string "name"
    t.text "description"
    t.integer "user_id"
    t.integer "position"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "shixuns_count", default: 0
    t.index ["subject_id"], name: "index_stages_on_subject_id"
  end

  create_table "statistic_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.float "score"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "base_score", default: 0
  end

  create_table "statistics", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.float "score", default: 1.0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "student_graduation_topics", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "graduation_topic_id"
    t.integer "course_id"
    t.integer "member_id"
    t.integer "status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "course_member_id"
    t.index ["course_id"], name: "index_student_graduation_topics_on_course_id"
    t.index ["graduation_topic_id"], name: "index_student_graduation_topics_on_graduation_topic_id"
    t.index ["user_id"], name: "index_student_graduation_topics_on_user_id"
  end

  create_table "student_work_projects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "homework_common_id"
    t.integer "student_work_id"
    t.integer "project_id"
    t.integer "user_id"
    t.integer "is_leader"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "course_id"
    t.index ["homework_common_id"], name: "index_student_work_projects_on_homework_common_id"
    t.index ["project_id"], name: "index_student_work_projects_on_project_id"
    t.index ["student_work_id"], name: "index_student_work_projects_on_student_work_id"
    t.index ["user_id"], name: "index_student_work_projects_on_user_id"
  end

  create_table "student_work_tests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "student_work_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "status", default: 9
    t.text "results"
    t.text "src"
    t.index ["student_work_id"], name: "index_student_work_tests_on_student_work_id"
  end

  create_table "student_works", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description", limit: 4294967295
    t.integer "homework_common_id"
    t.integer "user_id"
    t.float "final_score"
    t.float "teacher_score"
    t.float "student_score"
    t.float "teaching_asistant_score"
    t.integer "project_id", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "late_penalty", default: 0
    t.integer "absence_penalty", default: 0
    t.float "system_score", default: 0.0
    t.boolean "is_test", default: false
    t.integer "simi_id"
    t.integer "simi_value"
    t.float "work_score"
    t.integer "work_status", default: 0
    t.datetime "commit_time"
    t.integer "is_delete", default: 0
    t.integer "appeal_penalty", default: 0
    t.boolean "re_commit", default: false
    t.text "late_reason"
    t.integer "group_id", default: 0
    t.integer "myshixun_id", default: 0
    t.datetime "update_time"
    t.integer "commit_user_id"
    t.boolean "ultimate_score", default: false
    t.integer "cost_time", default: 0
    t.integer "compelete_status", default: 0
    t.float "efficiency", default: 0.0
    t.float "eff_score", default: 0.0
    t.datetime "calculation_time"
    t.integer "update_user_id"
    t.index ["homework_common_id", "user_id"], name: "index_on_homework_common_id_user_id", unique: true
    t.index ["myshixun_id"], name: "index_student_works_on_myshixun_id"
  end

  create_table "student_works_evaluation_distributions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "student_work_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["student_work_id", "user_id"], name: "index_on_student_work_id_and_user_id", unique: true
  end

  create_table "student_works_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "student_work_id"
    t.integer "user_id"
    t.float "score"
    t.text "comment"
    t.integer "reviewer_role"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "appeal_status", default: 0
    t.boolean "is_hidden", default: false
    t.boolean "is_ultimate", default: false
    t.boolean "is_invalid", default: false
    t.integer "homework_common_id", default: 0
    t.index ["student_work_id"], name: "student_work_id"
    t.index ["user_id"], name: "user_id"
  end

  create_table "student_works_scores_appeals", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "student_works_score_id"
    t.integer "user_id"
    t.text "comment"
    t.integer "appeal_status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["student_works_score_id"], name: "index_student_works_scores_appeals_on_student_works_score_id"
  end

  create_table "students_for_courses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "student_id"
    t.integer "course_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_id"], name: "index_students_for_courses_on_course_id"
    t.index ["student_id"], name: "index_students_for_courses_on_student_id"
  end

  create_table "sub_discipline_containers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "sub_discipline_id"
    t.integer "container_id"
    t.string "container_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["container_type", "container_id"], name: "index_on_container"
    t.index ["sub_discipline_id"], name: "index_sub_discipline_containers_on_sub_discipline_id"
  end

  create_table "sub_disciplines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "discipline_id"
    t.string "name"
    t.boolean "subject", default: true
    t.boolean "shixun", default: true
    t.boolean "question", default: true
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "position", default: 0
    t.index ["discipline_id"], name: "index_sub_disciplines_on_discipline_id"
  end

  create_table "sub_document_comments", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "content"
    t.text "title"
    t.integer "sub_domain_id"
    t.integer "creator_id"
    t.integer "parent_id"
    t.integer "reply_id"
    t.integer "locked"
    t.integer "sticky"
    t.integer "org_subfield_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "sub_domains", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "org_subfield_id"
    t.integer "priority", default: 0
    t.string "name"
    t.string "field_type"
    t.integer "hide", default: 0
    t.integer "status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "sub_repertoires", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "repertoire_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["repertoire_id"], name: "index_sub_repertoires_on_repertoire_id"
  end

  create_table "subfield_subdomain_dirs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "org_subfield_id"
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "subject_appointments", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "subject_id"
    t.bigint "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["subject_id"], name: "index_subject_appointments_on_subject_id"
    t.index ["user_id"], name: "index_subject_appointments_on_user_id"
  end

  create_table "subject_course_records", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "subject_id"
    t.bigint "school_id"
    t.string "school_name"
    t.integer "course_count", default: 0
    t.integer "student_count", default: 0
    t.integer "choice_shixun_num", default: 0
    t.integer "choice_shixun_frequency", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["school_id", "subject_id"], name: "couse_and_school_index", unique: true
    t.index ["school_id"], name: "index_subject_course_records_on_school_id"
    t.index ["subject_id"], name: "index_subject_course_records_on_subject_id"
  end

  create_table "subject_level_systems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "level"
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "subject_members", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "subject_id"
    t.integer "user_id"
    t.integer "role"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "position", default: 1
    t.index ["subject_id"], name: "index_subject_members_on_subject_id"
    t.index ["user_id"], name: "index_subject_members_on_user_id"
  end

  create_table "subject_records", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "subject_id"
    t.integer "study_count", default: 0
    t.integer "course_study_count", default: 0
    t.integer "initiative_study", default: 0
    t.integer "passed_count", default: 0
    t.integer "course_used_count", default: 0
    t.integer "school_used_count", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["subject_id"], name: "index_subject_records_on_subject_id", unique: true
  end

  create_table "subject_shixun_infos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "subject_id"
    t.bigint "shixun_id"
    t.string "stage"
    t.string "shixun_name"
    t.integer "challenge_count", default: 0
    t.integer "course_count", default: 0
    t.integer "school_count", default: 0
    t.integer "used_count", default: 0
    t.integer "passed_count", default: 0
    t.integer "evaluate_count", default: 0
    t.integer "passed_ave_time", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["shixun_id", "subject_id"], name: "index_subject_shixun_infos_on_shixun_id_and_subject_id", unique: true
    t.index ["shixun_id"], name: "index_subject_shixun_infos_on_shixun_id"
    t.index ["subject_id"], name: "index_subject_shixun_infos_on_subject_id"
  end

  create_table "subject_user_infos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "subject_id"
    t.string "username"
    t.integer "passed_myshixun_count", default: 0
    t.integer "passed_games_count", default: 0
    t.integer "code_line_count", default: 0
    t.integer "evaluate_count", default: 0
    t.string "cost_time", default: "0"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["subject_id"], name: "index_subject_user_infos_on_subject_id"
    t.index ["user_id", "subject_id"], name: "index_subject_user_infos_on_user_id_and_subject_id", unique: true
    t.index ["user_id"], name: "index_subject_user_infos_on_user_id"
  end

  create_table "subjects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "user_id"
    t.integer "visits", default: 1
    t.integer "status", default: 0
    t.integer "course_list_id"
    t.integer "major_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "hidden", default: false
    t.text "learning_notes"
    t.string "introduction"
    t.integer "stages_count", default: 0
    t.integer "stage_shixuns_count", default: 0
    t.boolean "homepage_show", default: false
    t.integer "repertoire_id"
    t.integer "score_count"
    t.datetime "publish_time"
    t.integer "shixuns_count", default: 0
    t.integer "subject_level_system_id"
    t.boolean "excellent", default: false
    t.integer "student_count", default: 0
    t.integer "participant_count", default: 0
    t.string "team_title", default: "教学团队"
    t.integer "copy_subject_id"
    t.integer "public", default: 0
    t.boolean "show_mobile", default: false
    t.index ["course_list_id"], name: "index_subjects_on_course_list_id"
    t.index ["major_id"], name: "index_subjects_on_major_id"
    t.index ["subject_level_system_id"], name: "index_subjects_on_subject_level_system_id"
    t.index ["user_id"], name: "index_subjects_on_user_id"
  end

  create_table "syllabus_members", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "rank"
    t.integer "syllabus_id"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["rank"], name: "index_syllabus_members_on_rank"
    t.index ["syllabus_id"], name: "index_syllabus_members_on_syllabus_id"
    t.index ["user_id"], name: "index_syllabus_members_on_user_id"
  end

  create_table "syllabus_update_records", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "syllabus_id"
    t.integer "property"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["syllabus_id"], name: "index_syllabus_update_records_on_syllabus_id"
    t.index ["user_id"], name: "index_syllabus_update_records_on_user_id"
  end

  create_table "syllabuses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "title"
    t.text "description"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "eng_name"
    t.integer "syllabus_type"
    t.integer "credit"
    t.integer "hours"
    t.integer "theory_hours"
    t.integer "practice_hours"
    t.string "applicable_major"
    t.string "pre_course"
    t.integer "visits", default: 0
    t.integer "des_status", default: 0
    t.integer "major_level"
    t.integer "discipline_category_id"
    t.integer "first_level_discipline_id"
    t.integer "major_id"
    t.index ["user_id"], name: "index_syllabuses_on_user_id"
  end

  create_table "system_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "content"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.text "description"
    t.string "subject"
  end

  create_table "system_update_notices", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "subject"
    t.text "notes"
    t.datetime "start_time"
    t.datetime "end_time"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "notice_type"
  end

  create_table "tag_discipline_containers", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "tag_discipline_id"
    t.integer "container_id"
    t.string "container_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["container_type", "container_id"], name: "index_on_container"
    t.index ["tag_discipline_id"], name: "index_tag_discipline_containers_on_tag_discipline_id"
  end

  create_table "tag_disciplines", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "sub_discipline_id"
    t.string "name"
    t.boolean "subject", default: true
    t.boolean "shixun", default: true
    t.boolean "question", default: true
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "user_id"
    t.integer "position", default: 0
    t.index ["sub_discipline_id"], name: "index_tag_disciplines_on_sub_discipline_id"
  end

  create_table "tag_repertoires", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "sub_repertoire_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "taggings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "tag_id"
    t.integer "taggable_id"
    t.string "taggable_type"
    t.integer "tagger_id"
    t.string "tagger_type"
    t.string "context", limit: 128
    t.datetime "created_at"
    t.index ["context"], name: "index_taggings_on_context"
    t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
    t.index ["tag_id"], name: "index_taggings_on_tag_id"
    t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
    t.index ["taggable_id", "taggable_type", "tagger_id", "context"], name: "taggings_idy"
    t.index ["taggable_id"], name: "index_taggings_on_taggable_id"
    t.index ["taggable_type"], name: "index_taggings_on_taggable_type"
    t.index ["tagger_id", "tagger_type"], name: "index_taggings_on_tagger_id_and_tagger_type"
    t.index ["tagger_id"], name: "index_taggings_on_tagger_id"
  end

  create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", collation: "utf8_bin"
    t.integer "taggings_count", default: 0
  end

  create_table "teacher_course_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "member_id"
    t.integer "course_group_id"
    t.integer "user_id"
    t.integer "course_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "course_member_id"
    t.index ["course_group_id"], name: "index_teacher_course_groups_on_course_group_id"
    t.index ["course_id"], name: "index_teacher_course_groups_on_course_id"
    t.index ["course_member_id"], name: "index_teacher_course_groups_on_course_member_id"
    t.index ["user_id"], name: "index_teacher_course_groups_on_user_id"
  end

  create_table "teacher_group_records", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "course_id"
    t.integer "group_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["course_id"], name: "index_teacher_group_records_on_course_id"
    t.index ["user_id", "course_id"], name: "index_teacher_group_records_on_user_id_and_course_id", unique: true
    t.index ["user_id"], name: "index_teacher_group_records_on_user_id"
  end

  create_table "teachers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "tea_name"
    t.string "location"
    t.integer "couurse_time"
    t.integer "course_code"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "extra"
  end

  create_table "team_members", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "competition_team_id"
    t.integer "user_id"
    t.integer "role"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "competition_id"
    t.boolean "is_teacher", default: false
    t.index ["competition_id"], name: "index_team_members_on_competition_id"
    t.index ["competition_team_id"], name: "index_team_members_on_competition_team_id"
    t.index ["user_id"], name: "index_team_members_on_user_id"
  end

  create_table "test_sets", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.text "input", limit: 4294967295
    t.text "output", limit: 4294967295
    t.integer "challenge_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "is_public", default: true
    t.boolean "result", default: true
    t.integer "position"
    t.integer "score"
    t.string "match_rule"
    t.boolean "ignore_space", default: true
    t.index ["challenge_id"], name: "testset"
  end

  create_table "tidings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "trigger_user_id"
    t.integer "container_id"
    t.string "container_type"
    t.integer "parent_container_id"
    t.string "parent_container_type"
    t.integer "belong_container_id"
    t.string "belong_container_type"
    t.integer "status", default: 0
    t.boolean "viewed"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "tiding_type"
    t.string "extra"
    t.boolean "is_delete", default: false
    t.index ["container_id"], name: "index_tidings_on_container_id"
    t.index ["user_id"], name: "index_tidings_on_user_id"
  end

  create_table "time_entries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id", null: false
    t.integer "user_id", null: false
    t.integer "issue_id"
    t.float "hours", null: false
    t.string "comments"
    t.integer "activity_id", null: false
    t.date "spent_on", null: false
    t.integer "tyear", null: false
    t.integer "tmonth", null: false
    t.integer "tweek", null: false
    t.datetime "created_on", null: false
    t.datetime "updated_on", null: false
    t.index ["activity_id"], name: "index_time_entries_on_activity_id"
    t.index ["created_on"], name: "index_time_entries_on_created_on"
    t.index ["issue_id"], name: "time_entries_issue_id"
    t.index ["project_id"], name: "time_entries_project_id"
    t.index ["user_id"], name: "index_time_entries_on_user_id"
  end

  create_table "tokens", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", default: 0, null: false
    t.string "action", limit: 30, default: "", null: false
    t.string "value", limit: 40, default: "", null: false
    t.datetime "created_on", null: false
    t.index ["user_id"], name: "index_tokens_on_user_id"
    t.index ["value"], name: "tokens_value", unique: true
  end

  create_table "trackers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name", limit: 30, default: "", null: false
    t.boolean "is_in_chlog", default: false, null: false
    t.integer "position", default: 1
    t.boolean "is_in_roadmap", default: true, null: false
    t.integer "fields_bits", default: 0
  end

  create_table "training_payinfos", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "invoice_title"
    t.string "invoice_no"
    t.string "invoice_content"
    t.integer "status"
    t.integer "training_id"
    t.integer "pay_type"
    t.string "info"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "out_trade_no"
    t.integer "attachment_id"
    t.integer "num", default: 1, null: false
    t.integer "fee", default: 2000, null: false
    t.index ["training_id"], name: "index_training_payinfos_on_training_id"
  end

  create_table "training_tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id"
    t.integer "tracker_id"
    t.string "subject"
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "author_id"
    t.integer "status", limit: 1, default: 0
    t.integer "position", limit: 1, default: 0
    t.integer "result", default: 0
  end

  create_table "trainings", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "sex"
    t.string "school"
    t.string "position"
    t.string "address"
    t.string "phone"
    t.string "email"
    t.string "openid"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "training_type", default: 1
    t.string "major"
    t.string "student_id"
    t.string "research_field"
    t.string "job_title"
    t.string "uncertified_major"
  end

  create_table "trustie_hackathons", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.integer "trustie_hacks_count", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "trustie_hacks", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.bigint "user_id"
    t.integer "hack_users_count", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "trustie_hackathon_id"
    t.index ["trustie_hackathon_id"], name: "index_trustie_hacks_on_trustie_hackathon_id"
    t.index ["user_id"], name: "index_trustie_hacks_on_user_id"
  end

  create_table "upgrade_notices", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "title"
    t.text "content"
    t.datetime "start_at"
    t.datetime "end_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "user_actions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "action_type"
    t.integer "action_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "ip"
    t.index ["ip"], name: "index_user_actions_on_ip"
  end

  create_table "user_activities", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "act_type"
    t.integer "act_id"
    t.string "container_type"
    t.integer "container_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "user_id"
    t.index ["act_id", "act_type", "container_id", "created_at"], name: "user_act_index"
  end

  create_table "user_agents", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "agent_type"
    t.string "key"
    t.string "ip"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "register_status", default: 0
    t.integer "action_status", default: 0
    t.index ["ip"], name: "index_user_agents_on_ip", unique: true
  end

  create_table "user_day_certifications", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "status", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_user_day_certifications_on_user_id"
  end

  create_table "user_extensions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", null: false
    t.date "birthday"
    t.string "brief_introduction"
    t.integer "gender"
    t.string "location"
    t.string "occupation"
    t.integer "work_experience"
    t.integer "zip_code"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.string "technical_title"
    t.integer "identity"
    t.string "student_id"
    t.string "teacher_realname"
    t.string "student_realname"
    t.string "location_city"
    t.integer "school_id"
    t.string "description", default: ""
    t.integer "department_id"
    t.index ["department_id"], name: "index_user_extensions_on_department_id"
    t.index ["school_id", "user_id"], name: "index_user_extensions_on_school_id_and_user_id"
    t.index ["user_id"], name: "index_user_extensions_on_user_id"
  end

  create_table "user_feedback_messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "journals_for_message_id"
    t.string "journals_for_message_type"
    t.integer "viewed"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["journals_for_message_id"], name: "index_user_feedback_messages_on_journals_for_message_id"
    t.index ["user_id", "created_at"], name: "index_user_feedback_messages_on_user_id_and_created_at"
  end

  create_table "user_grades", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", null: false
    t.integer "project_id", null: false
    t.float "grade", default: 0.0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["grade"], name: "index_user_grades_on_grade"
    t.index ["project_id"], name: "index_user_grades_on_project_id"
    t.index ["user_id"], name: "index_user_grades_on_user_id"
  end

  create_table "user_hidden_modules", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "module_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_user_hidden_modules_on_user_id"
  end

  create_table "user_interests", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.bigint "repertoire_id"
    t.index ["repertoire_id"], name: "index_user_interests_on_repertoire_id"
    t.index ["user_id"], name: "index_user_interests_on_user_id"
  end

  create_table "user_levels", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
    t.integer "user_id"
    t.integer "level"
  end

  create_table "user_preferences", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", default: 0, null: false
    t.text "others"
    t.boolean "hide_mail", default: false
    t.string "time_zone"
    t.index ["user_id"], name: "index_user_preferences_on_user_id"
  end

  create_table "user_score_details", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "current_user_id"
    t.integer "target_user_id"
    t.string "score_type"
    t.string "score_action"
    t.integer "user_id"
    t.integer "old_score"
    t.integer "new_score"
    t.integer "current_user_level"
    t.integer "target_user_level"
    t.integer "score_changeable_obj_id"
    t.string "score_changeable_obj_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "user_scores", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id", null: false
    t.integer "collaboration"
    t.integer "influence"
    t.integer "skill"
    t.integer "active"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "user_searches", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "search_type"
    t.string "subject"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_user_searches_on_user_id"
  end

  create_table "user_sources", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "type"
    t.integer "user_id"
    t.string "uuid"
    t.string "name"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["type", "uuid"], name: "index_user_sources_on_type_and_uuid", unique: true
    t.index ["user_id"], name: "index_user_sources_on_user_id"
  end

  create_table "user_statuses", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "changesets_count"
    t.integer "watchers_count"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "grade", default: 0.0
    t.index ["changesets_count"], name: "index_user_statuses_on_changesets_count"
    t.index ["grade"], name: "index_user_statuses_on_grade"
    t.index ["watchers_count"], name: "index_user_statuses_on_watchers_count"
  end

  create_table "user_system_notices", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "notice_type"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_user_system_notices_on_user_id"
  end

  create_table "user_wechats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "subscribe"
    t.string "openid"
    t.string "nickname"
    t.integer "sex"
    t.string "language"
    t.string "city"
    t.string "province"
    t.string "country"
    t.string "headimgurl"
    t.string "subscribe_time"
    t.string "unionid"
    t.string "remark"
    t.integer "groupid"
    t.integer "user_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "bindtype", default: 0
  end

  create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "login", default: "", null: false
    t.string "hashed_password", limit: 40, default: "", null: false
    t.string "firstname", limit: 30, default: "", null: false
    t.string "lastname", default: "", null: false
    t.string "mail", limit: 60
    t.boolean "admin", default: false, null: false
    t.integer "status", default: 1, null: false
    t.datetime "last_login_on"
    t.string "language", limit: 5, default: ""
    t.integer "auth_source_id"
    t.datetime "created_on"
    t.datetime "updated_on"
    t.string "type"
    t.string "identity_url"
    t.string "mail_notification", default: "", null: false
    t.string "salt", limit: 64
    t.integer "gid"
    t.integer "visits", default: 0
    t.integer "excellent_teacher", default: 0
    t.integer "excellent_student", default: 0
    t.string "phone"
    t.boolean "authentication", default: false
    t.integer "grade", default: 0
    t.integer "experience", default: 0
    t.string "nickname"
    t.boolean "show_realname", default: true
    t.boolean "professional_certification", default: false
    t.string "ID_number"
    t.integer "certification", default: 0
    t.boolean "homepage_teacher", default: false
    t.boolean "homepage_engineer", default: false
    t.integer "is_test", limit: 1, default: 0
    t.integer "ecoder_user_id", default: 0
    t.boolean "business", default: false
    t.boolean "profile_completed", default: false
    t.bigint "laboratory_id"
    t.boolean "is_shixun_marker", default: false
    t.boolean "admin_visitable", default: false
    t.index ["ecoder_user_id"], name: "index_users_on_ecoder_user_id"
    t.index ["homepage_engineer"], name: "index_users_on_homepage_engineer"
    t.index ["homepage_teacher"], name: "index_users_on_homepage_teacher"
    t.index ["laboratory_id"], name: "index_users_on_laboratory_id"
    t.index ["login"], name: "index_users_on_login", unique: true
    t.index ["mail"], name: "index_users_on_mail", unique: true
    t.index ["phone"], name: "index_users_on_phone", unique: true
  end

  create_table "users_authentications", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "authentication_id"
  end

  create_table "verification_codes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "code"
    t.integer "code_type"
    t.integer "status"
    t.string "phone"
    t.string "email"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["email"], name: "by_email"
    t.index ["phone"], name: "by_phone"
  end

  create_table "versions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id", default: 0, null: false
    t.string "name", default: "", null: false
    t.string "description", default: ""
    t.date "effective_date"
    t.datetime "created_on"
    t.datetime "updated_on"
    t.string "wiki_page_title"
    t.string "status", default: "open"
    t.string "sharing", default: "none", null: false
    t.integer "user_id"
    t.index ["project_id"], name: "versions_project_id"
    t.index ["sharing"], name: "index_versions_on_sharing"
  end

  create_table "video_applies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "video_id"
    t.string "status"
    t.string "reason"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["video_id"], name: "index_video_applies_on_video_id"
  end

  create_table "videos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.string "title"
    t.string "uuid", comment: "Aliyun媒体ID"
    t.string "cover_url", comment: "视频封面"
    t.string "file_url", comment: "视频地址"
    t.string "status"
    t.string "vod_status", comment: "Aliyun媒体状态"
    t.datetime "published_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "filesize", default: 0
    t.integer "vv", default: 0
    t.integer "play_duration", default: 0
    t.string "play_url"
    t.boolean "transcoded", default: false
    t.integer "delete_state"
    t.float "duration", default: 0.0
    t.index ["delete_state"], name: "index_videos_on_delete_state"
    t.index ["published_at"], name: "index_videos_on_published_at"
    t.index ["user_id"], name: "index_videos_on_user_id"
    t.index ["uuid"], name: "index_videos_on_uuid", unique: true
  end

  create_table "visitors", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "master_id"
    t.datetime "updated_on"
    t.datetime "created_on"
    t.index ["master_id"], name: "index_visitors_master_id"
    t.index ["updated_on"], name: "index_visitors_updated_on"
    t.index ["user_id"], name: "index_visitors_user_id"
  end

  create_table "watch_course_video_details", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "user_id"
    t.text "times"
    t.bigint "watch_course_video_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["user_id"], name: "index_watch_course_video_details_on_user_id"
    t.index ["watch_course_video_id"], name: "index_watch_course_video_details_on_watch_course_video_id"
  end

  create_table "watch_course_videos", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "course_video_id"
    t.bigint "user_id"
    t.boolean "is_finished", default: false
    t.float "duration", default: 0.0
    t.float "watch_duration", default: 0.0
    t.datetime "start_at"
    t.datetime "end_at"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "total_duration", default: 0.0
    t.integer "last_point", default: 0
    t.index ["course_video_id"], name: "index_watch_course_videos_on_course_video_id"
    t.index ["user_id"], name: "index_watch_course_videos_on_user_id"
  end

  create_table "watch_video_histories", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.bigint "watch_course_video_id"
    t.bigint "user_id"
    t.bigint "video_id"
    t.boolean "is_finished", default: false
    t.float "duration", default: 0.0
    t.float "watch_duration", default: 0.0
    t.datetime "start_at"
    t.datetime "end_at"
    t.string "device"
    t.string "ip"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.float "total_duration", default: 0.0
    t.integer "last_point", default: 0
    t.index ["user_id"], name: "index_watch_video_histories_on_user_id"
    t.index ["video_id"], name: "index_watch_video_histories_on_video_id"
    t.index ["watch_course_video_id"], name: "index_watch_video_histories_on_watch_course_video_id"
  end

  create_table "watchers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "watchable_type", default: "", null: false
    t.integer "watchable_id", default: 0, null: false
    t.integer "user_id"
    t.index ["user_id", "watchable_type"], name: "watchers_user_id_type"
    t.index ["user_id"], name: "index_watchers_on_user_id"
    t.index ["watchable_id", "watchable_type"], name: "index_watchers_on_watchable_id_and_watchable_type"
  end

  create_table "weapp_settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "type"
    t.string "link"
    t.boolean "online", default: false
    t.integer "position", default: 0
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "web_footer_companies", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.string "logo_size"
    t.string "url"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "web_footer_oranizers", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.text "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "websshes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "myshixun_id"
    t.string "host"
    t.integer "port"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "wechat_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "openid", null: false
    t.text "request_raw"
    t.text "response_raw"
    t.text "session_raw"
    t.datetime "created_at", null: false
    t.index ["openid"], name: "index_wechat_logs_on_openid"
  end

  create_table "wechat_pays", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "training_id"
    t.string "appid"
    t.string "bank_type"
    t.string "cash_fee"
    t.string "fee_type"
    t.string "is_subscribe"
    t.string "mch_id"
    t.string "nonce_str"
    t.string "openid"
    t.string "out_trade_no"
    t.string "result_code"
    t.string "return_code"
    t.string "time_end"
    t.string "total_fee"
    t.string "transaction_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["training_id"], name: "index_wechat_pays_on_training_id"
    t.index ["transaction_id"], name: "index_wechat_pays_on_transaction_id", unique: true
  end

  create_table "wiki_content_versions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "wiki_content_id", null: false
    t.integer "page_id", null: false
    t.integer "author_id"
    t.binary "data", limit: 4294967295
    t.string "compression", limit: 6, default: ""
    t.string "comments", default: ""
    t.datetime "updated_on", null: false
    t.integer "version", null: false
    t.index ["updated_on"], name: "index_wiki_content_versions_on_updated_on"
    t.index ["wiki_content_id"], name: "wiki_content_versions_wcid"
  end

  create_table "wiki_contents", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "page_id", null: false
    t.integer "author_id"
    t.text "text", limit: 4294967295
    t.string "comments", default: ""
    t.datetime "updated_on", null: false
    t.integer "version", null: false
    t.index ["author_id"], name: "index_wiki_contents_on_author_id"
    t.index ["page_id"], name: "wiki_contents_page_id"
  end

  create_table "wiki_pages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "wiki_id", null: false
    t.string "title", null: false
    t.datetime "created_on", null: false
    t.boolean "protected", default: false, null: false
    t.integer "parent_id"
    t.index ["parent_id"], name: "index_wiki_pages_on_parent_id"
    t.index ["wiki_id", "title"], name: "wiki_pages_wiki_id_title"
    t.index ["wiki_id"], name: "index_wiki_pages_on_wiki_id"
  end

  create_table "wiki_redirects", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "wiki_id", null: false
    t.string "title"
    t.string "redirects_to"
    t.datetime "created_on", null: false
    t.index ["wiki_id", "title"], name: "wiki_redirects_wiki_id_title"
    t.index ["wiki_id"], name: "index_wiki_redirects_on_wiki_id"
  end

  create_table "wikis", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "project_id", null: false
    t.string "start_page", null: false
    t.integer "status", default: 1, null: false
    t.index ["project_id"], name: "wikis_project_id"
  end

  create_table "work_detail_groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "work_id"
    t.integer "min_num"
    t.integer "max_num"
    t.boolean "base_on_project"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["work_id"], name: "index_work_detail_groups_on_work_id"
  end

  create_table "work_detail_manuals", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.date "evaluation_start"
    t.date "evaluation_end"
    t.integer "evaluation_num"
    t.integer "work_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["work_id"], name: "index_work_detail_manuals_on_work_id"
  end

  create_table "workflows", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "tracker_id", default: 0, null: false
    t.integer "old_status_id", default: 0, null: false
    t.integer "new_status_id", default: 0, null: false
    t.integer "role_id", default: 0, null: false
    t.boolean "assignee", default: false, null: false
    t.boolean "author", default: false, null: false
    t.string "type", limit: 30
    t.string "field_name", limit: 30
    t.string "rule", limit: 30
    t.index ["new_status_id"], name: "index_workflows_on_new_status_id"
    t.index ["old_status_id"], name: "index_workflows_on_old_status_id"
    t.index ["role_id", "tracker_id", "old_status_id"], name: "wkfs_role_tracker_old_status"
    t.index ["role_id"], name: "index_workflows_on_role_id"
  end

  create_table "works", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "name"
    t.integer "user_id"
    t.text "description"
    t.date "publish_time"
    t.date "end_time"
    t.integer "work_type"
    t.integer "contest_id"
    t.boolean "is_delete", default: false
    t.boolean "score_open", default: false
    t.boolean "is_open", default: false
    t.integer "work_status"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.boolean "online_evaluation", default: false
    t.boolean "score_valid", default: true
    t.index ["contest_id"], name: "index_works_on_contest_id"
    t.index ["user_id"], name: "index_works_on_user_id"
  end

  create_table "works_categories", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.string "category"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "zip_packs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
    t.integer "user_id"
    t.integer "homework_id"
    t.string "file_digest"
    t.string "file_path"
    t.integer "pack_times", default: 1
    t.float "pack_size", default: 0.0
    t.text "file_digests"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.integer "container_id", default: 0
    t.string "container_type"
    t.index ["container_id", "container_type"], name: "index_zip_packs_on_container_id_and_container_type"
  end

  add_foreign_key "knowledge_point_containers", "knowledge_points"
  add_foreign_key "knowledge_points", "curriculums"
end
