From 4efb66021415c2c0ea717589dbf04a126d109bad Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Thu, 26 Nov 2015 09:57:53 +0800
Subject: [PATCH 01/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Gemfile | 7 ++
app/controllers/users_controller.rb | 2 +-
app/controllers/welcome_controller.rb | 117 ++++++++++++++----
app/helpers/application_helper.rb | 17 +++
app/models/attachment.rb | 75 ++++++++++-
app/models/course.rb | 74 ++++++++++-
app/models/project.rb | 54 +++++++-
app/models/user.rb | 73 ++++++++++-
app/views/kaminari/_paginator.html.erb | 1 -
app/views/layouts/_logined_header.html.erb | 64 +++++-----
app/views/layouts/_unlogin_header.html.erb | 64 +++++-----
.../welcome/_search_all_results.html.erb | 73 +++++++++++
.../_search_attachment_results.html.erb | 20 +++
.../welcome/_search_course_results.html.erb | 20 +++
.../welcome/_search_project_results.html.erb | 24 ++++
.../welcome/_search_user_results.html.erb | 24 ++++
app/views/welcome/search.html.erb | 100 +++++++++++++++
app/views/welcome/search.js.erb | 13 ++
config/initializers/kaminari_config.rb | 6 +-
config/routes.rb | 7 +-
db/schema.rb | 104 +++++-----------
public/images/search_icon_03.png | Bin 0 -> 1186 bytes
public/stylesheets/new_user.css | 20 +++
23 files changed, 773 insertions(+), 186 deletions(-)
create mode 100644 app/views/welcome/_search_all_results.html.erb
create mode 100644 app/views/welcome/_search_attachment_results.html.erb
create mode 100644 app/views/welcome/_search_course_results.html.erb
create mode 100644 app/views/welcome/_search_project_results.html.erb
create mode 100644 app/views/welcome/_search_user_results.html.erb
create mode 100644 app/views/welcome/search.html.erb
create mode 100644 app/views/welcome/search.js.erb
create mode 100644 public/images/search_icon_03.png
diff --git a/Gemfile b/Gemfile
index 3027c16cd..a67fcfaea 100644
--- a/Gemfile
+++ b/Gemfile
@@ -30,6 +30,13 @@ gem 'rails_kindeditor',path:'lib/rails_kindeditor'
#gem "rmagick", ">= 2.0.0"
gem 'binding_of_caller'
gem 'chinese_pinyin'
+# gem 'sunspot_rails', '~> 1.3.3'
+# gem 'sunspot_solr'
+# gem 'sunspot'
+# gem 'progress_bar'
+gem 'kaminari'
+gem 'elasticsearch-model'
+gem 'elasticsearch-rails'
group :development do
gem 'grape-swagger'
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 776e6b7d5..8188ce12e 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1856,7 +1856,7 @@ class UsersController < ApplicationController
# 根据资源关键字进行搜索
def resource_search
search = params[:search].to_s.strip.downcase
- if(params[:type].nil? || params[:type] == "1") #全部
+ if(params[:type].nil? || params[:type].blank? || params[:type] == "1") #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询
@attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index 784066378..4b75a3297 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -151,36 +151,101 @@ class WelcomeController < ApplicationController
end
def search
- search_condition = params[:q]
- search_type = params[:search_type].to_sym unless search_condition.blank?
- search_by = params[:search_by]
+ @name = params[:q]
+ @search_type = params[:search_type]
+ case params[:search_type]
+ when 'all'
+ @alls = Elasticsearch::Model.search({
+ query: {
+ multi_match: {
+ query: @name,
+ type:"most_fields",
+ fields: ['login^5', 'firstname','lastname','name^5','description','filename^5']
+ }
+ },
+ highlight: {
+ pre_tags: [''],
+ post_tags: [''],
+ fields: {
+ login: {},
+ firstname: {},
+ lastname: {},
+ name:{},
+ description:{},
+ filename:{}
+ }
+ }
+ },[User,Course,Attachment,Project] ).page(params[:page] || 1).per(20).results
+ when 'user'
+ @users = User.search(@name).page(params[:page] || 1).per(20)
+ when 'project'
+ @projects = Project.search(@name).page(params[:page] || 1).per(20).results
+ when 'course'
+ @courses = Course.search(@name).page(params[:page] || 1).per(20).results
+ when 'attachment'
+ @attachments = Attachment.search(@name).page(params[:page] || 1).per(20).results
+ else
+ @alls = Elasticsearch::Model.search({
+ query: {
+ multi_match: {
+ query: @name,
+ type:"most_fields",
+ fields: ['login^5', 'firstname','lastname','name^5','description','filename^5']
+ }
+ },
+ highlight: {
+ pre_tags: [''],
+ post_tags: [''],
+ fields: {
+ login: {},
+ firstname: {},
+ lastname: {},
+ name:{},
+ description:{},
+ filename:{}
+ }
+ }
+ },[User,Course,Attachment,Project] ).page(params[:page] || 1).per(20).results
- if search_type.nil? && params[:contests_search] && params[:name] != ""
- search_type = :contests
- search_condition = params[:name]
end
+ @users_count = User.search(@name).results.total
+
+ @course_count = Course.search(@name).results.total
+ @attach_count = Attachment.search(@name).results.total
+ @project_count = Project.search(@name).results.total
+ @total_count = Elasticsearch::Model.search({
+ query: {
+ multi_match: {
+ query: @name,
+ type:"most_fields",
+ fields: ['login^5', 'firstname','lastname','name^5','description','filename^5']
+ }
+ },
+ highlight: {
+ pre_tags: [''],
+ post_tags: [''],
+ fields: {
+ login: {},
+ firstname: {},
+ lastname: {},
+ name:{},
+ description:{},
+ filename:{}
+ }
+ }
+ },[User,Course,Attachment,Project] ).results.total
+ # search_type = params[:search_type].to_sym unless search_condition.blank?
+ # search_by = params[:search_by]
+ #
+ # if search_type.nil? && params[:contests_search] && params[:name] != ""
+ # search_type = :contests
+ # search_condition = params[:name]
+ # end
+
respond_to do |format|
- format.html{
- case search_type
- when :projects
- redirect_to projects_search_url(:name => search_condition,
- :project_type => Project::ProjectType_project)
- when :courses
- redirect_to courses_search_url(:name => search_condition)
- when :contests
- redirect_to contests_url(:name => search_condition)
- when :users
- redirect_to users_search_url(:name => search_condition,:search_by => search_by)
- when :users_teacher
- redirect_to users_search_url(:name => search_condition, :search_by => search_by, :role => :teacher)
- when :users_student
- redirect_to users_search_url(:name => search_condition, :search_by => search_by, :role => :student)
- else
- #redirect_to home_path, :alert => l(:label_sumbit_empty)
- (redirect_to signin_path, :notice => l(:label_sumbit_empty);return) #if params[:name].blank?
- end
- }
+ format.js
+ format.html{ render :layout=>'users_base'}
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f4e0f88ff..15e29f39c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1825,6 +1825,23 @@ module ApplicationHelper
s
end
+ def get_user_identity identity
+ s = ""
+ case identity
+ when 0
+ s = '教师'
+ when 1
+ s = '学生'
+ when 2
+ s = '组织'
+ when 3
+ s= '开发者'
+ else
+ s = '学生'
+ end
+ s
+ end
+
def get_memo
@new_memo = Memo.new
@public_forum = Forum.find(1) rescue ActiveRecord::RecordNotFound
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index f7fb9b1aa..a98111b4f 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -17,7 +17,7 @@
require "digest/md5"
require "fileutils"
-
+require 'elasticsearch/model'
class Attachment < ActiveRecord::Base
belongs_to :container, :polymorphic => true
belongs_to :project, foreign_key: 'container_id', conditions: "attachments.container_type = 'Project'"
@@ -38,6 +38,17 @@ class Attachment < ActiveRecord::Base
validates :description, length: {maximum: 254}
validate :validate_max_file_size
+ #elasticsearch
+ include Elasticsearch::Model
+ #elasticsearch kaminari init
+ Kaminari::Hooks.init
+ Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
+ settings index: { number_of_shards: 1 } do
+ mappings dynamic: 'false' do
+ indexes :filename, analyzer: 'smartcn',index_options: 'offsets'
+ end
+ end
+
acts_as_taggable
acts_as_event :title => :filename,
@@ -74,9 +85,9 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location,:act_as_course_activity
- after_create :office_conver, :be_user_score,:act_as_forge_activity
- after_update :office_conver, :be_user_score
- after_destroy :delete_from_disk,:down_user_score
+ after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
+ after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
+ after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index
# add by nwb
# 获取所有可公开的资源文件列表
@@ -92,7 +103,25 @@ class Attachment < ActiveRecord::Base
" LEFT JOIN #{News.table_name} ON #{Attachment.table_name}.container_type='News' AND (#{News.table_name}.project_id in "+self.public_project_id + " OR #{News.table_name}.course_id in " + self.public_course_id + ")" +
" LEFT JOIN #{HomeworkAttach.table_name} ON #{Attachment.table_name}.container_type='HomeworkAttach' AND #{HomeworkAttach.table_name}.bid_id in "+self.public_bid_id)
}
-
+ def self.search(query)
+ __elasticsearch__.search(
+ {
+ query: {
+ multi_match: {
+ query: query,
+ fields: ['filename']
+ }
+ },
+ highlight: {
+ pre_tags: [''],
+ post_tags: [''],
+ fields: {
+ filename: {}
+ }
+ }
+ }
+ )
+ end
# add by nwb
# 公开的项目id列表
def self.public_project_id
@@ -560,4 +589,40 @@ class Attachment < ActiveRecord::Base
self.course_acts << CourseActivity.new(:user_id => self.author_id,:course_id => self.container_id)
end
end
+
+ def create_attachment_ealasticsearch_index
+ if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) ||
+ ( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
+ self.container_type == 'Principal')
+ self.__elasticsearch__.index_document
+ end
+ end
+ def update_attachment_ealasticsearch_index
+ if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) ||
+ ( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
+ self.container_type == 'Principal')
+ self.__elasticsearch__.update_document
+ end
+ end
+ def delete_attachment_ealasticsearch_index
+ if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) ||
+ ( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
+ self.container_type == 'Principal')
+ self.__elasticsearch__.delete_document
+ end
+ end
end
+
+# Delete the previous articles index in Elasticsearch
+# Attachment.__elasticsearch__.client.indices.delete index: Attachment.index_name rescue nil
+#
+# # Create the new index with the new mapping
+# Attachment.__elasticsearch__.client.indices.create \
+# index: Attachment.index_name,
+# body: { settings: Attachment.settings.to_hash, mappings: Attachment.mappings.to_hash }
+
+# Index all article records from the DB to Elasticsearch
+#暂时只做公开课程/项目里的公开资源 和其他的公开资源
+Attachment.where('is_public = 1 and ((container_type in ("Principal")) ' +
+ 'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+
+ 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import
diff --git a/app/models/course.rb b/app/models/course.rb
index 7288c3b3b..1991c00cb 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -1,10 +1,23 @@
-
+require 'elasticsearch/model'
class Course < ActiveRecord::Base
include Redmine::SafeAttributes
STATUS_ACTIVE = 1
STATUS_CLOSED = 5
STATUS_ARCHIVED = 9
+
+ #elasticsearch
+ include Elasticsearch::Model
+
+ #elasticsearch kaminari init
+ Kaminari::Hooks.init
+ Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
+ settings index: { number_of_shards: 1 } do
+ mappings dynamic: 'false' do
+ indexes :name, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :description, analyzer: 'smartcn',index_options: 'offsets'
+ end
+ end
attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name
#belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier
@@ -51,9 +64,9 @@ class Course < ActiveRecord::Base
validates_length_of :description, :maximum => 10000
before_save :self_validate
# 公开课程变成私有课程,所有资源都变成私有
- after_update :update_files_public
- after_create :create_board_sync, :act_as_course_activity, :act_as_course_message
- before_destroy :delete_all_members
+ after_update :update_files_public,:update_course_ealasticsearch_index
+ after_create :create_board_sync, :act_as_course_activity, :act_as_course_message,:create_course_ealasticsearch_index
+ before_destroy :delete_all_members,:delete_course_ealasticsearch_index
safe_attributes 'extra',
'time',
@@ -96,6 +109,27 @@ class Course < ActiveRecord::Base
end
}
+ def self.search(query)
+ __elasticsearch__.search(
+ {
+ query: {
+ multi_match: {
+ query: query,
+ fields: ['name', 'description']
+ }
+ },
+ highlight: {
+ pre_tags: [''],
+ post_tags: [''],
+ fields: {
+ name: {},
+ description: {}
+ }
+ }
+ }
+ )
+ end
+
def visible?(user=User.current)
user.allowed_to?(:view_course, self)
end
@@ -339,6 +373,38 @@ class Course < ActiveRecord::Base
#def name
# read_attribute('name') || Project.find_by_identifier(self.extra).try(:name)
#end
+
+ # after_commit on: [:create] do
+ # __elasticsearch__.index_document
+ # end
+ #
+ # after_commit on: [:update] do
+ # __elasticsearch__.update_document
+ # end
+ #
+ # after_commit on: [:destroy] do
+ # __elasticsearch__.delete_document
+ # end
+ def create_course_ealasticsearch_index
+ self.__elasticsearch__.index_document
+ end
+ def update_course_ealasticsearch_index
+ self.__elasticsearch__.update_document
+ end
+ def delete_course_ealasticsearch_index
+ self.__elasticsearch__.delete_document
+ end
end
+# Delete the previous articles index in Elasticsearch
+# Course.__elasticsearch__.client.indices.delete index: Course.index_name rescue nil
+#
+# # Create the new index with the new mapping
+# Course.__elasticsearch__.client.indices.create \
+# index: Course.index_name,
+# body: { settings: Course.settings.to_hash, mappings: Course.mappings.to_hash }
+
+# Index all article records from the DB to Elasticsearch
+Course.import
+
diff --git a/app/models/project.rb b/app/models/project.rb
index 0b0420920..53e909776 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
+require 'elasticsearch/model'
class Project < ActiveRecord::Base
include Redmine::SafeAttributes
ProjectType_project = 0
@@ -30,6 +30,18 @@ class Project < ActiveRecord::Base
# Specific overidden Activities
+ #elasticsearch
+ include Elasticsearch::Model
+ #elasticsearch kaminari init
+ Kaminari::Hooks.init
+ Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
+ settings index: { number_of_shards: 1 } do
+ mappings dynamic: 'false' do
+ indexes :name, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :description, analyzer: 'smartcn',index_options: 'offsets'
+ end
+ end
+
has_many :student_works
has_many :time_entry_activities
has_many :members, :include => [:principal, :roles], :conditions => "#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{Principal::STATUS_ACTIVE}"
@@ -138,8 +150,9 @@ class Project < ActiveRecord::Base
#ActiveModel::Dirty 这里有一个changed方法。对任何对象都可以用
after_save :update_inherited_members, :if => Proc.new {|project| project.inherit_members_changed?}
# 创建project之后默认创建一个board,之后的board去掉了board的概念
- after_create :create_board_sync,:acts_as_forge_activities
- before_destroy :delete_all_members
+ after_create :create_board_sync,:acts_as_forge_activities,:create_project_ealasticsearch_index
+ before_destroy :delete_all_members,:delete_project_ealasticsearch_index
+ after_update :update_project_ealasticsearch_index
def remove_references_before_destroy
return if self.id.nil?
Watcher.delete_all ['watchable_id = ?', id]
@@ -172,7 +185,27 @@ class Project < ActiveRecord::Base
}
scope :project_entities, -> { where(project_type: ProjectType_project) }
scope :course_entities, -> { where(project_type: ProjectType_course) }
-
+
+ def self.search(query)
+ __elasticsearch__.search(
+ {
+ query: {
+ multi_match: {
+ query: query,
+ fields: ['name','description']
+ }
+ },
+ highlight: {
+ pre_tags: [''],
+ post_tags: [''],
+ fields: {
+ name: {},
+ description: {}
+ }
+ }
+ }
+ )
+ end
def new_course
self.where('project_type = ?', 1)
end
@@ -1176,5 +1209,18 @@ class Project < ActiveRecord::Base
end
+ def create_project_ealasticsearch_index
+ self.__elasticsearch__.index_document
+ end
+ def update_project_ealasticsearch_index
+ self.__elasticsearch__.update_document
+ end
+ def delete_project_ealasticsearch_index
+ self.__elasticsearch__.delete_document
+ end
+
+
end
+Project.import
+
diff --git a/app/models/user.rb b/app/models/user.rb
index 85b9e2591..3818e5d47 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -16,7 +16,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require "digest/sha1"
-
+require 'elasticsearch/model'
class User < Principal
TEACHER = 0
STUDENT = 1
@@ -25,6 +25,19 @@ class User < Principal
include Redmine::SafeAttributes
seems_rateable_rater
+ #elasticsearch
+ include Elasticsearch::Model
+ #elasticsearch kaminari init
+ Kaminari::Hooks.init
+ Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
+ settings index: { number_of_shards: 1 } do
+ mappings dynamic: 'false' do
+ indexes :login, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :firstname, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :lastname, analyzer: 'smartcn',index_options: 'offsets'
+ end
+ end
+
# Different ways of displaying/sorting users
USER_FORMATS = {
:firstname_lastname => {
@@ -64,6 +77,7 @@ class User < Principal
},
}
+
#每日一报、一事一报、不报
MAIL_NOTIFICATION_OPTIONS = [
#['week', :label_user_mail_option_week],
@@ -154,6 +168,7 @@ class User < Principal
#####
has_many :shares ,:dependent => :destroy
+
# add by zjc
has_one :level, :class_name => 'UserLevels', :dependent => :destroy
has_many :memos , :foreign_key => 'author_id'
@@ -214,12 +229,12 @@ class User < Principal
# validates_email_realness_of :mail
before_create :set_mail_notification
before_save :update_hashed_password
- before_destroy :remove_references_before_destroy
+ before_destroy :remove_references_before_destroy,:delete_user_ealasticsearch_index
# added by fq
- after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity
+ after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index
# end
# 更新邮箱用户或用户名的同事,同步更新邀请信息
- after_update :update_invite_list
+ after_update :update_invite_list,:upadte_user_ealasticsearch_index
include Trustie::Gitlab::ManageUser
@@ -250,7 +265,27 @@ class User < Principal
end
end
}
-
+ def self.search(query)
+ __elasticsearch__.search(
+ {
+ query: {
+ multi_match: {
+ query: query,
+ fields: ['login', 'firstname','lastname']
+ }
+ },
+ highlight: {
+ pre_tags: [''],
+ post_tags: [''],
+ fields: {
+ login: {},
+ firstname: {},
+ lastname: {}
+ }
+ }
+ }
+ )
+ end
# ======================================================================
@@ -1145,4 +1180,32 @@ class AnonymousUser < User
def destroy
false
end
+
+ def create_user_ealasticsearch_index
+ if self.id != 2 && self.id != 4
+ self.__elasticsearch__.index_document
+ end
+ end
+ def update_user_ealasticsearch_index
+ if self.id != 2 && self.id != 4
+ self.__elasticsearch__.update_document
+ end
+ end
+ def delete_user_ealasticsearch_index
+ if self.id != 2 && self.id != 4
+ self.__elasticsearch__.delete_document
+ end
+ end
end
+
+# Delete the previous articles index in Elasticsearch
+# User.__elasticsearch__.client.indices.delete index: User.index_name rescue nil
+#
+# # Create the new index with the new mapping
+# User.__elasticsearch__.client.indices.create \
+# index: User.index_name,
+# body: { settings: User.settings.to_hash, mappings: User.mappings.to_hash }
+
+# Index all article records from the DB to Elasticsearch
+# 匿名用户 角色 和 管理员角色不能被索引
+User.where('id not in (2,4)').import
diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb
index b4d5ee4ea..9a2a02ab9 100644
--- a/app/views/kaminari/_paginator.html.erb
+++ b/app/views/kaminari/_paginator.html.erb
@@ -8,7 +8,6 @@
-%>
<%= paginator.render do -%>
- <%#= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index 6e62e2d5e..bf1166021 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -18,24 +18,24 @@
+
+
+
+
+
+
+
+
+
+
+ <%#= render :partial => 'search_user_results',:locals => {:users=>@users}%>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/views/welcome/search.js.erb b/app/views/welcome/search.js.erb
new file mode 100644
index 000000000..c53c5d219
--- /dev/null
+++ b/app/views/welcome/search.js.erb
@@ -0,0 +1,13 @@
+<% case @search_type%>
+<% when 'all'%>
+$("#searchContent_1").html('<%= escape_javascript(render :partial => 'search_all_results',:locals => {:all_results=> @alls})%>');
+<% when 'user'%>
+$("#searchContent_2").html('<%= escape_javascript(render :partial => 'search_user_results',:locals => {:users=>@users})%>');
+<% when 'course'%>
+$("#searchContent_3").html('<%= escape_javascript(render :partial => 'search_course_results',:locals => {:courses=>@courses})%>');
+<% when 'project'%>
+$("#searchContent_5").html('<%= escape_javascript(render :partial => 'search_project_results',:locals => {:projects=>@projects})%>');
+<% when 'attachment'%>
+$("#searchContent_4").html('<%= escape_javascript(render :partial => 'search_attachment_results',:locals => {:attachments=>@attachments})%>');
+<%else%>
+<%end %>
\ No newline at end of file
diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb
index 1f07c0af5..5d1c9b6ad 100644
--- a/config/initializers/kaminari_config.rb
+++ b/config/initializers/kaminari_config.rb
@@ -23,10 +23,10 @@
Kaminari.configure do |config|
# config.default_per_page = 25
# config.max_per_page = nil
- config.window = 0
+ config.window = 1
# config.outer_window = 3
- # config.left = 2
- # config.right = 2
+ config.left = 2
+ config.right = 2
# config.page_method_name = :page
# config.param_name = :page
end
diff --git a/config/routes.rb b/config/routes.rb
index 69134e666..b684d1382 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -84,7 +84,7 @@ RedmineApp::Application.routes.draw do
resources :homework_users
resources :no_uses
delete 'no_uses', :to => 'no_uses#delete'
-
+ match 'site_search', :to => 'users#site_search', :as => 'site_search', :via => [:get, :post, :put]
resources :apply_project_masters
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
@@ -457,6 +457,11 @@ RedmineApp::Application.routes.draw do
end
end
end
+ resources :blog_comments do
+ collection do
+ get :search
+ end
+ end
match 'users/:id/user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "feedback"
match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get
#消息
diff --git a/db/schema.rb b/db/schema.rb
index 8658c302b..ea8e71df6 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,6 +10,7 @@
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
+
ActiveRecord::Schema.define(:version => 20151117075939) do
create_table "activities", :force => true do |t|
@@ -528,26 +529,23 @@ ActiveRecord::Schema.define(:version => 20151117075939) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id"
- create_table "dts", :primary_key => "Num", :force => true 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
+ create_table "dts", :force => true do |t|
+ t.string "IPLineCode"
t.string "Description"
- t.text "PreConditions", :limit => 2147483647
- t.text "TraceInfo", :limit => 2147483647
- t.text "Code", :limit => 2147483647
+ t.string "Num"
+ t.string "Variable"
+ t.string "TraceInfo"
+ t.string "Method"
+ t.string "File"
+ t.string "IPLine"
+ t.string "Review"
+ t.string "Category"
+ t.string "Defect"
+ t.string "PreConditions"
+ t.string "StartLine"
t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "id", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "enabled_modules", :force => true do |t|
@@ -572,60 +570,6 @@ ActiveRecord::Schema.define(:version => 20151117075939) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
- create_table "exercise_answers", :force => true do |t|
- t.integer "user_id"
- 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
- end
-
- create_table "exercise_choices", :force => true 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
- end
-
- create_table "exercise_questions", :force => true do |t|
- t.string "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
- end
-
- create_table "exercise_standard_answers", :force => true 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
- end
-
- create_table "exercise_users", :force => true do |t|
- t.integer "user_id"
- t.integer "exercise_id"
- t.integer "score"
- t.datetime "start_at"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "exercises", :force => true do |t|
- t.string "exercise_name"
- t.text "exercise_description"
- t.integer "course_id"
- t.integer "exercise_status"
- t.integer "user_id"
- t.integer "time"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
create_table "first_pages", :force => true do |t|
t.string "web_title"
t.string "title"
@@ -871,6 +815,16 @@ ActiveRecord::Schema.define(:version => 20151117075939) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
+ create_table "journal_details_copy", :force => true 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"
+ end
+
+ add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
+
create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id"
t.integer "user_id"
@@ -1103,6 +1057,12 @@ ActiveRecord::Schema.define(:version => 20151117075939) do
t.datetime "updated_at", :null => false
end
+ create_table "org_courses", :force => true do |t|
+ t.integer "organization_id"
+ t.integer "course_id"
+ t.datetime "created_at"
+ end
+
create_table "org_document_comments", :force => true do |t|
t.string "title"
t.text "content"
diff --git a/public/images/search_icon_03.png b/public/images/search_icon_03.png
new file mode 100644
index 0000000000000000000000000000000000000000..15ff587eb1182bb8cd6274aac895e0be75529839
GIT binary patch
literal 1186
zcmeAS@N?(olHy`uVBq!ia0vp^96&6v4
zq}24xJX@vryZ0+8WTx0Eg`4^s_!c;)W@LI)6{QAO`Gq7`WhYyvDB0U7*i={n4aiL`
zNmQuF&B-gas<2f8n`;GRgM{^!6u?SKvTcwn`GuBNuFf>#!Gt)CP
zF*P$Y)KM@pFf`IP03tJ8LlY}gGb`4?pZBPB7%B|o_|H#M)s)5TT^D5IB>nPO#OXkqMZ
z>SAK#WbEc@Y6$ecp^K$~ql=4?k)yejs~OA;Y`gLD2*8txIZAW?5>ATTynKn^_fq~-y0Oc5|^
zFwB+u3(QuRJY5_^DsGir+|TV8D01NAb5${~NYVNRUrEmynk}n@%X$iwQNmy45$F
zOxY~C=M#Gb?<-!l=06-i=j~b_H@*Co@t)s)&*xS5txuoJqsufyseShSAH7;x=h|2P
z^+|kSXR!5BvdbQ!T_;|Dx8#&8eJ`o~W-d#nQJ1Bh#={2wHVyAqyGb)1G|5Iu9Gup&
zVO5#CfMV&lL(xLFEEaXDUwW~iamJT~#eGXRIm)np*S;2^(8$&G;brlQgP&$KFN{;T
s8^2dbW!o>kf4RlWo=uusTF)xM@cqAftmdKI;Vst01}vu&j0`b
literal 0
HcmV?d00001
diff --git a/public/stylesheets/new_user.css b/public/stylesheets/new_user.css
index 6ccfc47f6..753d179e7 100644
--- a/public/stylesheets/new_user.css
+++ b/public/stylesheets/new_user.css
@@ -1326,3 +1326,23 @@ a:hover.link_file_a{ background:url(../images/pic_file.png) 0 -25px no-repeat; c
span.author { font-size: 0.9em; color: #888; }
.ReplyToMessageInputContainer {width: 582px;float: left;}
+/*全站搜索*/
+.blocks {padding:15px; background-color:#ffffff; border:1px solid #dddddd;}
+#searchBanner {border-bottom:1px solid #d0d0d0;}
+#searchBanner li {float:left; width:88px; margin-right:3px; text-align:center; padding-bottom:10px; font-weight:bold;}
+#searchTips {padding:10px 5px; background-color:#f5f6f7;}
+.searchBannerActive {border-bottom:3px solid #3498db !important;}
+.searchBannerNormal {border-bottom:none !important;}
+.searchContent {min-height:74px; border-bottom:1px solid #ededed; padding:13px 0px;}
+.searchCourseware {min-height:44px; border-bottom:1px solid #ededed; padding:13px 0px; width:968px;}
+.searchCourseImage {width:75px; margin-right:10px;}
+.searchContentDes {width:883px;}
+.searchTag {font-size:12px; color:#ffffff; background-color:#7ec8e4; height:16px; min-height:16px; max-height:16px; float:left; line-height:16px; padding:0px 3px;}
+.undis {display:none;}
+.dis {display:inline-block;}
+.numRed {color:#FF6600;}
+.pageRoll {float:right; border-left:1px solid #dddddd; margin-top:15px;}
+.pageCell {border:1px solid #dddddd; padding:5px 12px; float:left; margin-left:-1px; position:relative;}
+.pageCell:hover {border:1px solid #3498db; z-index:10;}
+.pageCellActive {background-color:#3498db; border:1px solid #3498db !important; position:relative; color:#ffffff;}
+
From dcd441a9db79c7a2fef1bf4a6d50abb8054ee1b1 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Thu, 26 Nov 2015 16:43:10 +0800
Subject: [PATCH 02/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/welcome_controller.rb | 9 ++++++---
app/models/attachment.rb | 9 ++++++++-
app/models/board.rb | 2 +-
app/models/course.rb | 11 +++++++++--
app/models/document.rb | 2 +-
app/models/issue.rb | 2 +-
app/models/journals_for_message.rb | 3 ++-
app/models/message.rb | 2 +-
app/models/news.rb | 2 +-
app/models/project.rb | 11 +++++++++--
app/models/project_tags.rb | 2 +-
app/models/user.rb | 9 ++++++++-
config/application.rb | 3 ++-
13 files changed, 50 insertions(+), 17 deletions(-)
diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb
index 4b75a3297..815a44839 100644
--- a/app/controllers/welcome_controller.rb
+++ b/app/controllers/welcome_controller.rb
@@ -160,7 +160,8 @@ class WelcomeController < ApplicationController
multi_match: {
query: @name,
type:"most_fields",
- fields: ['login^5', 'firstname','lastname','name^5','description','filename^5']
+ operator: "or",
+ fields: ['login', 'firstname','lastname','name','description^0.5','filename']
}
},
highlight: {
@@ -190,7 +191,8 @@ class WelcomeController < ApplicationController
multi_match: {
query: @name,
type:"most_fields",
- fields: ['login^5', 'firstname','lastname','name^5','description','filename^5']
+ operator: "or",
+ fields: ['login', 'firstname','lastname','name','description^0.5','filename']
}
},
highlight: {
@@ -219,7 +221,8 @@ class WelcomeController < ApplicationController
multi_match: {
query: @name,
type:"most_fields",
- fields: ['login^5', 'firstname','lastname','name^5','description','filename^5']
+ operator: "or",
+ fields: ['login', 'firstname','lastname','name','description^0.5','filename']
}
},
highlight: {
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index a98111b4f..3cb2d9057 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -46,6 +46,7 @@ class Attachment < ActiveRecord::Base
settings index: { number_of_shards: 1 } do
mappings dynamic: 'false' do
indexes :filename, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :downloads, analyzer: 'smartcn',index_options: 'offsets'
end
end
@@ -109,9 +110,15 @@ class Attachment < ActiveRecord::Base
query: {
multi_match: {
query: query,
+ type:"most_fields",
+ operator: "or",
fields: ['filename']
}
},
+ sort:{
+ downloads: {order:"desc"},
+ _score:{order:"desc"}
+ },
highlight: {
pre_tags: [''],
post_tags: [''],
@@ -625,4 +632,4 @@ end
#暂时只做公开课程/项目里的公开资源 和其他的公开资源
Attachment.where('is_public = 1 and ((container_type in ("Principal")) ' +
'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+
- 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import
+ 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import :force=>true
diff --git a/app/models/board.rb b/app/models/board.rb
index edcbe0c9d..35a7a72d1 100644
--- a/app/models/board.rb
+++ b/app/models/board.rb
@@ -17,7 +17,7 @@
class Board < ActiveRecord::Base
include Redmine::SafeAttributes
- belongs_to :project
+ belongs_to :project,:touch => true
belongs_to :course
has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC"
has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC"
diff --git a/app/models/course.rb b/app/models/course.rb
index 1991c00cb..71cd74633 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -16,6 +16,7 @@ class Course < ActiveRecord::Base
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :updated_at, analyzer: 'smartcn',index_options: 'offsets'
end
end
@@ -115,9 +116,15 @@ class Course < ActiveRecord::Base
query: {
multi_match: {
query: query,
- fields: ['name', 'description']
+ type:"most_fields",
+ operator: "or",
+ fields: ['name', 'description^0.5']
}
},
+ sort: {
+ updated_at:{order:"desc"},
+ _score:{order: "desc" }
+ },
highlight: {
pre_tags: [''],
post_tags: [''],
@@ -405,6 +412,6 @@ end
# body: { settings: Course.settings.to_hash, mappings: Course.mappings.to_hash }
# Index all article records from the DB to Elasticsearch
-Course.import
+Course.where('is_public = 1').import :force=>true
diff --git a/app/models/document.rb b/app/models/document.rb
index 37983d6d4..b45a74775 100644
--- a/app/models/document.rb
+++ b/app/models/document.rb
@@ -17,7 +17,7 @@
class Document < ActiveRecord::Base
include Redmine::SafeAttributes
- belongs_to :project
+ belongs_to :project,:touch=>true
belongs_to :user
belongs_to :category, :class_name => "DocumentCategory", :foreign_key => "category_id"
include UserScoreHelper
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 2a6da44c5..edce3310a 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -19,7 +19,7 @@ class Issue < ActiveRecord::Base
include Redmine::SafeAttributes
include Redmine::Utils::DateCalculation
include UserScoreHelper
- belongs_to :project
+ belongs_to :project,:touch=> true
belongs_to :tracker
belongs_to :status, :class_name => 'IssueStatus', :foreign_key => 'status_id'
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index 5e40267cb..14760a631 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -21,7 +21,8 @@ class JournalsForMessage < ActiveRecord::Base
after_destroy :delete_kindeditor_assets
belongs_to :project,
:foreign_key => 'jour_id',
- :conditions => "#{self.table_name}.jour_type = 'Project' "
+ :conditions => "#{self.table_name}.jour_type = 'Project' ",:touch => true
+
belongs_to :course,
:foreign_key => 'jour_id'
diff --git a/app/models/message.rb b/app/models/message.rb
index 7af59815b..c5371097a 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -20,7 +20,7 @@ class Message < ActiveRecord::Base
include UserScoreHelper
include ApplicationHelper
has_many_kindeditor_assets :assets, :dependent => :destroy
- belongs_to :board
+ belongs_to :board,:touch => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :praise_tread, as: :praise_tread_object, dependent: :destroy
diff --git a/app/models/news.rb b/app/models/news.rb
index e9b8b5314..aa5d6df1f 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -17,7 +17,7 @@
class News < ActiveRecord::Base
include Redmine::SafeAttributes
- belongs_to :project
+ belongs_to :project,:touch => true
include ApplicationHelper
has_many_kindeditor_assets :assets, :dependent => :destroy
#added by nwb
diff --git a/app/models/project.rb b/app/models/project.rb
index 53e909776..92e6a4d0b 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -39,6 +39,7 @@ class Project < ActiveRecord::Base
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :updated_on, analyzer: 'smartcn',index_options: 'offsets'
end
end
@@ -192,9 +193,15 @@ class Project < ActiveRecord::Base
query: {
multi_match: {
query: query,
- fields: ['name','description']
+ type:"most_fields",
+ operator: "and",
+ fields: ['name','description^0.5']
}
},
+ sort: {
+ updated_on:{order: "desc" },
+ _score:{order: "desc" }
+ },
highlight: {
pre_tags: [''],
post_tags: [''],
@@ -1222,5 +1229,5 @@ class Project < ActiveRecord::Base
end
-Project.import
+Project.where('is_public = 1').import :force=>true
diff --git a/app/models/project_tags.rb b/app/models/project_tags.rb
index 16de1ea45..bcf666fb5 100644
--- a/app/models/project_tags.rb
+++ b/app/models/project_tags.rb
@@ -2,7 +2,7 @@
class ProjectTags < ActiveRecord::Base
attr_accessible :description, :project_id, :tag_id, :user_id
####################################################################################################添加代码
- belongs_to :project
+ belongs_to :project,:touch => true
belongs_to :tag
belongs_to :user
diff --git a/app/models/user.rb b/app/models/user.rb
index 3818e5d47..fc18313a0 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -35,6 +35,7 @@ class User < Principal
indexes :login, analyzer: 'smartcn',index_options: 'offsets'
indexes :firstname, analyzer: 'smartcn',index_options: 'offsets'
indexes :lastname, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :last_login_on, analyzer: 'smartcn',index_options: 'offsets'
end
end
@@ -271,9 +272,15 @@ class User < Principal
query: {
multi_match: {
query: query,
+ type:"most_fields",
+ operator: "or",
fields: ['login', 'firstname','lastname']
}
},
+ sort:{
+ last_login_on: {order:"desc"},
+ _score:{order:"desc"}
+ },
highlight: {
pre_tags: [''],
post_tags: [''],
@@ -1208,4 +1215,4 @@ end
# Index all article records from the DB to Elasticsearch
# 匿名用户 角色 和 管理员角色不能被索引
-User.where('id not in (2,4)').import
+User.where('id not in (2,4)').import :force=>true
diff --git a/config/application.rb b/config/application.rb
index 6e4a2983a..14793fcac 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -2,7 +2,7 @@ require File.expand_path('../boot', __FILE__)
require 'rails/all'
require 'sprockets/railtie'
-
+require 'elasticsearch/model'
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
@@ -73,6 +73,7 @@ module RedmineApp
end
config.after_initialize do
+ Elasticsearch::Client.new hosts: ['localhost:9200', 'localhost:9201'], retry_on_failure: true,log:true
end
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
From ee47187a6148f70157a160faa97ae34c15e6b09b Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 09:52:51 +0800
Subject: [PATCH 03/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/course.rb | 2 +-
app/models/project.rb | 14 ++++++++++----
app/models/user.rb | 7 ++++---
config/application.rb | 8 +++++++-
4 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/app/models/course.rb b/app/models/course.rb
index 71cd74633..e73257033 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -16,7 +16,7 @@ class Course < ActiveRecord::Base
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
- indexes :updated_at, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :updated_at, analyzer: 'smartcn',index_options: 'offsets',type:"date"
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 92e6a4d0b..0453f1164 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -39,7 +39,7 @@ class Project < ActiveRecord::Base
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
- indexes :updated_on, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :updated_on, analyzer: 'smartcn',index_options: 'offsets', type:'date'
end
end
@@ -195,12 +195,12 @@ class Project < ActiveRecord::Base
query: query,
type:"most_fields",
operator: "and",
- fields: ['name','description^0.5']
+ fields: ['name']
}
},
sort: {
- updated_on:{order: "desc" },
- _score:{order: "desc" }
+ _score:{order: "desc" },
+ updated_on:{order: "desc" }
},
highlight: {
pre_tags: [''],
@@ -1217,13 +1217,19 @@ class Project < ActiveRecord::Base
def create_project_ealasticsearch_index
+ if self.is_public == 1
self.__elasticsearch__.index_document
+ end
end
def update_project_ealasticsearch_index
+ if self.is_public == 1
self.__elasticsearch__.update_document
+ end
end
def delete_project_ealasticsearch_index
+ if self.is_public == 1
self.__elasticsearch__.delete_document
+ end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index fc18313a0..15578f6db 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -35,7 +35,8 @@ class User < Principal
indexes :login, analyzer: 'smartcn',index_options: 'offsets'
indexes :firstname, analyzer: 'smartcn',index_options: 'offsets'
indexes :lastname, analyzer: 'smartcn',index_options: 'offsets'
- indexes :last_login_on, analyzer: 'smartcn',index_options: 'offsets'
+ indexes :last_login_on, analyzer: 'smartcn',index_options: 'offsets',type: 'date'
+ indexes :id, analyzer: 'smartcn',index_options: 'offsets'
end
end
@@ -278,8 +279,8 @@ class User < Principal
}
},
sort:{
- last_login_on: {order:"desc"},
- _score:{order:"desc"}
+ _score:{order:"desc"},
+ last_login_on: {order:"desc"}
},
highlight: {
pre_tags: [''],
diff --git a/config/application.rb b/config/application.rb
index 14793fcac..5f9c9d67e 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -73,7 +73,13 @@ module RedmineApp
end
config.after_initialize do
- Elasticsearch::Client.new hosts: ['localhost:9200', 'localhost:9201'], retry_on_failure: true,log:true
+ if RbConfig::CONFIG['target_os'] == 'mswin32'
+ Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
+ elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`)
+ Elasticsearch::Client.new hosts: ['192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true
+ elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`)
+ Elasticsearch::Client.new hosts: ['192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true
+ end
end
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))
From 7cb39d1754d500d95eb9cab6a019634a11c01833 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 10:40:58 +0800
Subject: [PATCH 04/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/attachment.rb | 9 ++++++---
app/models/course.rb | 4 ++--
app/models/project.rb | 4 ++--
app/models/user.rb | 4 ++--
lib/tasks/elasticsearch.rake | 1 +
5 files changed, 13 insertions(+), 9 deletions(-)
create mode 100644 lib/tasks/elasticsearch.rake
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 3cb2d9057..dea4e404e 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -104,6 +104,9 @@ class Attachment < ActiveRecord::Base
" LEFT JOIN #{News.table_name} ON #{Attachment.table_name}.container_type='News' AND (#{News.table_name}.project_id in "+self.public_project_id + " OR #{News.table_name}.course_id in " + self.public_course_id + ")" +
" LEFT JOIN #{HomeworkAttach.table_name} ON #{Attachment.table_name}.container_type='HomeworkAttach' AND #{HomeworkAttach.table_name}.bid_id in "+self.public_bid_id)
}
+ scope :indexable,lambda { where('is_public = 1 and ((container_type in ("Principal")) ' +
+ 'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+
+ 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')')} #用于elastic建索引的scope
def self.search(query)
__elasticsearch__.search(
{
@@ -630,6 +633,6 @@ end
# Index all article records from the DB to Elasticsearch
#暂时只做公开课程/项目里的公开资源 和其他的公开资源
-Attachment.where('is_public = 1 and ((container_type in ("Principal")) ' +
- 'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+
- 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import :force=>true
+#Attachment.where('is_public = 1 and ((container_type in ("Principal")) ' +
+# 'or (container_type = "Course" and container_id in( SELECT `courses`.id FROM `courses` WHERE (courses.status <> 9 AND courses.is_public = 1)) )'+
+# 'or (container_type = "Project" and container_id in(SELECT `projects`.id FROM `projects` WHERE (projects.status <> 9 AND projects.is_public = 1) ))' +')').import :force=>true
diff --git a/app/models/course.rb b/app/models/course.rb
index e73257033..8f7c990ab 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -109,7 +109,7 @@ class Course < ActiveRecord::Base
where(" LOWER(name) LIKE :p ", :p => pattern)
end
}
-
+ scope :indexable,lambda { where('is_public = 1') }
def self.search(query)
__elasticsearch__.search(
{
@@ -412,6 +412,6 @@ end
# body: { settings: Course.settings.to_hash, mappings: Course.mappings.to_hash }
# Index all article records from the DB to Elasticsearch
-Course.where('is_public = 1').import :force=>true
+#Course.where('is_public = 1').import :force=>true
diff --git a/app/models/project.rb b/app/models/project.rb
index 0453f1164..034873596 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -186,7 +186,7 @@ class Project < ActiveRecord::Base
}
scope :project_entities, -> { where(project_type: ProjectType_project) }
scope :course_entities, -> { where(project_type: ProjectType_course) }
-
+ scope :indexable,lambda { where('is_public = 1')} #用于elastic建索引的scope
def self.search(query)
__elasticsearch__.search(
{
@@ -1235,5 +1235,5 @@ class Project < ActiveRecord::Base
end
-Project.where('is_public = 1').import :force=>true
+#Project.where('is_public = 1').import :force=>true
diff --git a/app/models/user.rb b/app/models/user.rb
index 15578f6db..bf2bca6db 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -249,7 +249,7 @@ class User < Principal
where("#{User.table_name}.id NOT IN (SELECT gu.user_id FROM #{table_name_prefix}groups_users#{table_name_suffix} gu WHERE gu.group_id = ?)", group_id)
}
scope :sorted, lambda { order(*User.fields_for_order_statement)}
-
+ scope :indexable,lambda { where('id not in (2,4)')} #用于elastic建索引的scope,id为2是匿名用户,4是管理员,不能被索引
scope :like, lambda {|arg, type|
if arg.blank?
where(nil)
@@ -1216,4 +1216,4 @@ end
# Index all article records from the DB to Elasticsearch
# 匿名用户 角色 和 管理员角色不能被索引
-User.where('id not in (2,4)').import :force=>true
+#User.where('id not in (2,4)').import :force=>true
diff --git a/lib/tasks/elasticsearch.rake b/lib/tasks/elasticsearch.rake
new file mode 100644
index 000000000..1242abc60
--- /dev/null
+++ b/lib/tasks/elasticsearch.rake
@@ -0,0 +1 @@
+require 'elasticsearch/rails/tasks/import'
\ No newline at end of file
From f448b5f8e2ea2129f3d2e1c02e6717b2b893b947 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 11:00:06 +0800
Subject: [PATCH 05/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/application.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/application.rb b/config/application.rb
index 5f9c9d67e..fccf40742 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -76,9 +76,9 @@ module RedmineApp
if RbConfig::CONFIG['target_os'] == 'mswin32'
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`)
- Elasticsearch::Client.new hosts: ['192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true
+ Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`)
- Elasticsearch::Client.new hosts: ['192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true
+ Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true
end
end
From 768aff89da69c187e3db503d138a7a9238b7e29b Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 11:09:01 +0800
Subject: [PATCH 06/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/application.rb | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/config/application.rb b/config/application.rb
index fccf40742..fcf2d97d4 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -75,10 +75,14 @@ module RedmineApp
config.after_initialize do
if RbConfig::CONFIG['target_os'] == 'mswin32'
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
- elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`)
+ elsif RbConfig::CONFIG['target_os'] == 'linux' && ["fast76"].include?(`hostname`.gsub("\n",""))
+ Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
+ elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n",""))
Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true
- elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`)
+ elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n",""))
Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true
+ else
+ Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
end
end
From 6be917e052fbe162964bce7372ed1698b0c4206d Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 11:34:42 +0800
Subject: [PATCH 07/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/application.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/config/application.rb b/config/application.rb
index fcf2d97d4..69b88a76d 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -73,10 +73,10 @@ module RedmineApp
end
config.after_initialize do
- if RbConfig::CONFIG['target_os'] == 'mswin32'
+ if RbConfig::CONFIG['target_os'] == 'mingw32'
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["fast76"].include?(`hostname`.gsub("\n",""))
- Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
+ Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n",""))
Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n",""))
From bf1c1cf0a1082988d72e5597ed226a387ec7d579 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 13:07:09 +0800
Subject: [PATCH 08/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Gemfile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Gemfile b/Gemfile
index a67fcfaea..ee1342df5 100644
--- a/Gemfile
+++ b/Gemfile
@@ -34,6 +34,8 @@ gem 'chinese_pinyin'
# gem 'sunspot_solr'
# gem 'sunspot'
# gem 'progress_bar'
+gem 'ansi'
+gem 'win32console'
gem 'kaminari'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
From 0992ddd0f6d1d7b98fe089ba88a42edb8c2d243f Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 13:07:25 +0800
Subject: [PATCH 09/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
config/application.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/config/application.rb b/config/application.rb
index 69b88a76d..61f73ee3d 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -74,7 +74,7 @@ module RedmineApp
config.after_initialize do
if RbConfig::CONFIG['target_os'] == 'mingw32'
- Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
+ Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["fast76"].include?(`hostname`.gsub("\n",""))
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true,log:true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n",""))
From c28b8bab1486ea0025f0127cd79e301b89b23741 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 13:09:20 +0800
Subject: [PATCH 10/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Gemfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Gemfile b/Gemfile
index ee1342df5..0125e9d60 100644
--- a/Gemfile
+++ b/Gemfile
@@ -35,7 +35,7 @@ gem 'chinese_pinyin'
# gem 'sunspot'
# gem 'progress_bar'
gem 'ansi'
-gem 'win32console'
+
gem 'kaminari'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
@@ -44,6 +44,7 @@ group :development do
gem 'grape-swagger'
gem 'better_errors', '~> 1.1.0'
gem 'rack-mini-profiler', '~> 0.9.3'
+ gem 'win32console'
end
group :development, :test do
From 3d9f6321055bec0466e02e7676f5c7c9b3d471ca Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 14:42:25 +0800
Subject: [PATCH 11/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/elasticsearch_batch_op.rake | 31 +++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 lib/tasks/elasticsearch_batch_op.rake
diff --git a/lib/tasks/elasticsearch_batch_op.rake b/lib/tasks/elasticsearch_batch_op.rake
new file mode 100644
index 000000000..fb2c638bc
--- /dev/null
+++ b/lib/tasks/elasticsearch_batch_op.rake
@@ -0,0 +1,31 @@
+namespace :importer do
+ task :importuser do
+ ENV['CLASS']='User'
+ ENV['SCOPE']='indexable'
+ ENV['FORCE']='y'
+ ENV['BATCH']='1000'
+ Rake::Task["elasticsearch:import:model"].invoke
+ end
+ task :importproject do
+
+ ENV['CLASS']='Project'
+ ENV['SCOPE']='indexable'
+ ENV['FORCE']='y'
+ ENV['BATCH']='1000'
+ Rake::Task["elasticsearch:import:model"].invoke
+ end
+ task :importcourse do
+ ENV['CLASS']='Course'
+ ENV['SCOPE']='indexable'
+ ENV['FORCE']='y'
+ ENV['BATCH']='1000'
+ Rake::Task["elasticsearch:import:model"].invoke
+ end
+ task :importattachment do
+ ENV['CLASS']='Attachment'
+ ENV['SCOPE']='indexable'
+ ENV['FORCE']='y'
+ ENV['BATCH']='1000'
+ Rake::Task["elasticsearch:import:model"].invoke
+ end
+end
\ No newline at end of file
From e710f443c2dfc61d8711b872363cca32dab80417 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 15:17:17 +0800
Subject: [PATCH 12/21] =?UTF-8?q?=E5=85=A8=E7=AB=99=E6=90=9C=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/attachment.rb | 5 +++--
app/models/course.rb | 12 ++++++++++--
app/models/project.rb | 4 ++--
app/models/user.rb | 1 -
4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index dea4e404e..ebabbf944 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -119,8 +119,9 @@ class Attachment < ActiveRecord::Base
}
},
sort:{
- downloads: {order:"desc"},
- _score:{order:"desc"}
+ _score:{order:"desc"},
+ downloads: {order:"desc"}
+
},
highlight: {
pre_tags: [''],
diff --git a/app/models/course.rb b/app/models/course.rb
index 8f7c990ab..0bd14d38b 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -122,8 +122,9 @@ class Course < ActiveRecord::Base
}
},
sort: {
- updated_at:{order:"desc"},
- _score:{order: "desc" }
+ _score:{order: "desc" },
+ updated_at:{order:"desc"}
+
},
highlight: {
pre_tags: [''],
@@ -393,13 +394,20 @@ class Course < ActiveRecord::Base
# __elasticsearch__.delete_document
# end
def create_course_ealasticsearch_index
+ if self.is_public == 1
self.__elasticsearch__.index_document
+ end
end
def update_course_ealasticsearch_index
+ if self.is_public == 1
self.__elasticsearch__.update_document
+ end
end
def delete_course_ealasticsearch_index
+
+ if self.is_public == 1
self.__elasticsearch__.delete_document
+ end
end
end
diff --git a/app/models/project.rb b/app/models/project.rb
index 034873596..847c536da 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -194,8 +194,8 @@ class Project < ActiveRecord::Base
multi_match: {
query: query,
type:"most_fields",
- operator: "and",
- fields: ['name']
+ operator: "or",
+ fields: ['name','description^0.5']
}
},
sort: {
diff --git a/app/models/user.rb b/app/models/user.rb
index bf2bca6db..ced747af8 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -36,7 +36,6 @@ class User < Principal
indexes :firstname, analyzer: 'smartcn',index_options: 'offsets'
indexes :lastname, analyzer: 'smartcn',index_options: 'offsets'
indexes :last_login_on, analyzer: 'smartcn',index_options: 'offsets',type: 'date'
- indexes :id, analyzer: 'smartcn',index_options: 'offsets'
end
end
From 487c6bad0923776f37b09a98c533c182fa730f20 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 18:08:38 +0800
Subject: [PATCH 13/21] schema.rb
---
db/schema.rb | 51 +++++++++++++++++++++++++++------------------------
1 file changed, 27 insertions(+), 24 deletions(-)
diff --git a/db/schema.rb b/db/schema.rb
index 603ca6857..6e007d6be 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -543,26 +543,23 @@ ActiveRecord::Schema.define(:version => 20151127011351) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id"
- create_table "dts", :primary_key => "Num", :force => true 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
+ create_table "dts", :force => true do |t|
+ t.string "IPLineCode"
t.string "Description"
- t.text "PreConditions", :limit => 2147483647
- t.text "TraceInfo", :limit => 2147483647
- t.text "Code", :limit => 2147483647
+ t.string "Num"
+ t.string "Variable"
+ t.string "TraceInfo"
+ t.string "Method"
+ t.string "File"
+ t.string "IPLine"
+ t.string "Review"
+ t.string "Category"
+ t.string "Defect"
+ t.string "PreConditions"
+ t.string "StartLine"
t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
- t.integer "id", :null => false
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "enabled_modules", :force => true do |t|
@@ -605,7 +602,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do
end
create_table "exercise_questions", :force => true do |t|
- t.string "question_title"
+ t.text "question_title"
t.integer "question_type"
t.integer "question_number"
t.integer "exercise_id"
@@ -634,7 +631,7 @@ ActiveRecord::Schema.define(:version => 20151127011351) do
end
create_table "exercises", :force => true do |t|
- t.string "exercise_name"
+ t.text "exercise_name"
t.text "exercise_description"
t.integer "course_id"
t.integer "exercise_status"
@@ -892,6 +889,16 @@ ActiveRecord::Schema.define(:version => 20151127011351) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
+ create_table "journal_details_copy", :force => true 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"
+ end
+
+ add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
+
create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id"
t.integer "user_id"
@@ -1151,10 +1158,6 @@ ActiveRecord::Schema.define(:version => 20151127011351) do
create_table "org_members", :force => true do |t|
t.integer "user_id"
t.integer "organization_id"
-<<<<<<< HEAD
- t.string "role"
-=======
->>>>>>> 1ae514ca4857d7e2ad53b338731c1e01f899fb4d
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
From 96290ad97559cd5067aedfc5866160d0e9600c4f Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 18:47:19 +0800
Subject: [PATCH 14/21] Merge branch 'szzh' into dev_zanle
Conflicts:
app/models/attachment.rb
db/schema.rb
---
app/models/course.rb | 26 +-
app/models/user.rb | 34 +-
db/schema.rb | 3785 +++++++++++++++++++++---------------------
3 files changed, 1929 insertions(+), 1916 deletions(-)
diff --git a/app/models/course.rb b/app/models/course.rb
index 77850a89d..edc5e105b 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -400,19 +400,31 @@ class Course < ActiveRecord::Base
# end
def create_course_ealasticsearch_index
if self.is_public == 1
- self.__elasticsearch__.index_document
+ self.__elasticsearch__.index_document
end
end
def update_course_ealasticsearch_index
- if self.is_public == 1
- self.__elasticsearch__.update_document
+ if self.is_public == 1 #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
+ begin
+ self.__elasticsearch__.update_document
+ rescue => e
+ self.__elasticsearch__.index_document
+ end
+ else #如果是更新成为私有的,那么索引就要被删除
+ begin
+ self.__elasticsearch__.delete_document
+ rescue => e
+
+ end
end
end
- def delete_course_ealasticsearch_index
- if self.is_public == 1
- self.__elasticsearch__.delete_document
- end
+ def delete_course_ealasticsearch_index
+ begin
+ self.__elasticsearch__.delete_document
+ rescue => e
+
+ end
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 17a8f32ba..cdec39a3d 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -243,7 +243,7 @@ class User < Principal
after_create :act_as_activity, :add_onclick_time, :act_as_principal_activity,:create_user_ealasticsearch_index
# end
# 更新邮箱用户或用户名的同事,同步更新邀请信息
- after_update :update_invite_list,:upadte_user_ealasticsearch_index
+ after_update :update_invite_list,:update_user_ealasticsearch_index
include Trustie::Gitlab::ManageUser
@@ -1161,6 +1161,23 @@ class User < Principal
end
end
+
+ def create_user_ealasticsearch_index
+ if self.id != 2 && self.id != 4
+ self.__elasticsearch__.index_document
+ end
+ end
+ def update_user_ealasticsearch_index
+ if self.id != 2 && self.id != 4
+ self.__elasticsearch__.update_document
+ end
+ end
+ def delete_user_ealasticsearch_index
+ if self.id != 2 && self.id != 4
+ self.__elasticsearch__.delete_document
+ end
+ end
+
end
class AnonymousUser < User
@@ -1196,21 +1213,6 @@ class AnonymousUser < User
false
end
- def create_user_ealasticsearch_index
- if self.id != 2 && self.id != 4
- self.__elasticsearch__.index_document
- end
- end
- def update_user_ealasticsearch_index
- if self.id != 2 && self.id != 4
- self.__elasticsearch__.update_document
- end
- end
- def delete_user_ealasticsearch_index
- if self.id != 2 && self.id != 4
- self.__elasticsearch__.delete_document
- end
- end
end
# Delete the previous articles index in Elasticsearch
diff --git a/db/schema.rb b/db/schema.rb
index dd5278d93..0d4135f3d 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1,4 +1,4 @@
-<<<<<<< HEAD
+
# encoding: UTF-8
# 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
@@ -1815,1895 +1815,1894 @@ ActiveRecord::Schema.define(:version => 20151117075939) do
end
end
-=======
-# encoding: UTF-8
-# 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 to check this file into your version control system.
-
-ActiveRecord::Schema.define(:version => 20151127011351) do
-
- create_table "activities", :force => true 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"
- end
-
- add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type"
- add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
- add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
-
- create_table "activity_notifies", :force => true 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"
- end
-
- add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id"
- add_index "activity_notifies", ["created_on"], :name => "index_an_created_on"
- add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to"
-
- create_table "api_keys", :force => true 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
- end
-
- add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
- add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
-
- create_table "applied_projects", :force => true do |t|
- t.integer "project_id", :null => false
- t.integer "user_id", :null => false
- end
-
- create_table "apply_project_masters", :force => true 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 "attachments", :force => true 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 => 40, :default => "", :null => false
- t.integer "downloads", :default => 0, :null => false
- t.integer "author_id", :default => 0, :null => false
- t.datetime "created_on"
- t.string "description"
- t.string "disk_directory"
- t.integer "attachtype", :default => 1
- t.integer "is_public", :default => 1
- t.integer "copy_from"
- t.integer "quotes"
- end
-
- add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
- add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
- add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
-
- create_table "attachmentstypes", :force => true do |t|
- t.integer "typeId", :null => false
- t.string "typeName", :limit => 50
- end
-
- create_table "auth_sources", :force => true 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"
- end
-
- add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type"
-
- create_table "biding_projects", :force => true 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", :force => true 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", :force => true 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
- end
-
- create_table "blogs", :force => true 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
- end
-
- create_table "boards", :force => true 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"
- t.integer "course_id"
- end
-
- add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
- add_index "boards", ["project_id"], :name => "boards_project_id"
-
- create_table "bug_to_osps", :force => true 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 "changes", :force => true 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"
- end
-
- add_index "changes", ["changeset_id"], :name => "changesets_changeset_id"
-
- create_table "changeset_parents", :id => false, :force => true do |t|
- t.integer "changeset_id", :null => false
- t.integer "parent_id", :null => false
- end
-
- add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids"
- add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
-
- create_table "changesets", :force => true 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"
- end
-
- add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
- add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true
- add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid"
- add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id"
- add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id"
-
- create_table "changesets_issues", :id => false, :force => true do |t|
- t.integer "changeset_id", :null => false
- t.integer "issue_id", :null => false
- end
-
- add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
-
- create_table "code_review_assignments", :force => true 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", :force => true 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", :force => true 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", :force => true 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 "comments", :force => true 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
- end
-
- add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
- add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
-
- create_table "contest_notifications", :force => true do |t|
- t.text "title"
- t.text "content"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "contesting_projects", :force => true do |t|
- t.integer "project_id"
- t.string "contest_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 "contesting_softapplications", :force => true do |t|
- t.integer "softapplication_id"
- t.integer "contest_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 "contestnotifications", :force => true do |t|
- t.integer "contest_id"
- t.string "title"
- t.string "summary"
- t.text "description"
- t.integer "author_id"
- t.integer "notificationcomments_count"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "contests", :force => true do |t|
- t.string "name"
- t.string "budget", :default => ""
- t.integer "author_id"
- t.date "deadline"
- t.string "description"
- t.integer "commit"
- t.string "password"
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
- end
-
- create_table "course_activities", :force => true 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
- end
-
- create_table "course_attachments", :force => true 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_contributor_scores", :force => true do |t|
- t.integer "course_id"
- t.integer "user_id"
- t.integer "message_num"
- t.integer "message_reply_num"
- t.integer "news_reply_num"
- t.integer "resource_num"
- t.integer "journal_num"
- t.integer "journal_reply_num"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.integer "total_score"
- end
-
- create_table "course_groups", :force => true do |t|
- t.string "name"
- t.integer "course_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "course_infos", :force => true 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_messages", :force => true 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.string "content"
- t.integer "status"
- end
-
- create_table "course_statuses", :force => true 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 "courses", :force => true 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.string "class_period"
- 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
- end
-
- create_table "custom_fields", :force => true 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
- end
-
- add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type"
-
- create_table "custom_fields_projects", :id => false, :force => true do |t|
- t.integer "custom_field_id", :default => 0, :null => false
- t.integer "project_id", :default => 0, :null => false
- end
-
- add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true
-
- create_table "custom_fields_trackers", :id => false, :force => true do |t|
- t.integer "custom_field_id", :default => 0, :null => false
- t.integer "tracker_id", :default => 0, :null => false
- end
-
- add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true
-
- create_table "custom_values", :force => true 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"
- end
-
- add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id"
- add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
-
- create_table "delayed_jobs", :force => true 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"
- end
-
- add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
-
- create_table "discuss_demos", :force => true do |t|
- t.string "title"
- t.text "body"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "documents", :force => true 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
- end
-
- add_index "documents", ["category_id"], :name => "index_documents_on_category_id"
- add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
- add_index "documents", ["project_id"], :name => "documents_project_id"
-
- create_table "dts", :force => true do |t|
- t.string "IPLineCode"
- t.string "Description"
- t.string "Num"
- t.string "Variable"
- t.string "TraceInfo"
- t.string "Method"
- t.string "File"
- t.string "IPLine"
- t.string "Review"
- t.string "Category"
- t.string "Defect"
- t.string "PreConditions"
- t.string "StartLine"
- t.integer "project_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "enabled_modules", :force => true do |t|
- t.integer "project_id"
- t.string "name", :null => false
- t.integer "course_id"
- end
-
- add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id"
-
- create_table "enumerations", :force => true 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
- end
-
- add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
- add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
-
- create_table "exercise_answers", :force => true do |t|
- t.integer "user_id"
- 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
- end
-
- create_table "exercise_choices", :force => true 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
- end
-
- create_table "exercise_questions", :force => true 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.integer "question_score"
- end
-
- create_table "exercise_standard_answers", :force => true 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
- end
-
- create_table "exercise_users", :force => true do |t|
- t.integer "user_id"
- t.integer "exercise_id"
- t.integer "score"
- t.datetime "start_at"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.datetime "end_at"
- t.integer "status"
- end
-
- create_table "exercises", :force => true do |t|
- t.text "exercise_name"
- t.text "exercise_description"
- t.integer "course_id"
- t.integer "exercise_status"
- t.integer "user_id"
- t.integer "time"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.datetime "publish_time"
- t.datetime "end_time"
- t.integer "show_result"
- end
-
- create_table "first_pages", :force => true 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", :force => true 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
- end
-
- add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id"
-
- create_table "forge_messages", :force => true 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"
- end
-
- create_table "forums", :force => true 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"
- end
-
- create_table "groups_users", :id => false, :force => true do |t|
- t.integer "group_id", :null => false
- t.integer "user_id", :null => false
- end
-
- add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
-
- create_table "homework_attaches", :force => true 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
- end
-
- add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
-
- create_table "homework_commons", :force => true do |t|
- t.string "name"
- t.integer "user_id"
- t.text "description"
- t.date "publish_time"
- t.date "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
- end
-
- create_table "homework_detail_manuals", :force => true do |t|
- t.float "ta_proportion"
- t.integer "comment_status"
- t.date "evaluation_start"
- t.date "evaluation_end"
- t.integer "evaluation_num"
- t.integer "absence_penalty", :default => 1
- t.integer "homework_common_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "homework_detail_programings", :force => true do |t|
- t.string "language"
- t.text "standard_code", :limit => 2147483647
- 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", :force => true 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", :force => true do |t|
- t.integer "course_id"
- t.integer "bid_id"
- end
-
- add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
- add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
-
- create_table "homework_tests", :force => true 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", :force => true 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 "invite_lists", :force => true 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", :force => true do |t|
- t.integer "project_id", :default => 0, :null => false
- t.string "name", :limit => 30, :default => "", :null => false
- t.integer "assigned_to_id"
- end
-
- add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id"
- add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
-
- create_table "issue_relations", :force => true 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"
- end
-
- add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true
- add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id"
- add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id"
-
- create_table "issue_statuses", :force => true 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"
- end
-
- add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed"
- add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default"
- add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position"
-
- create_table "issues", :force => true 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"
- end
-
- add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id"
- add_index "issues", ["author_id"], :name => "index_issues_on_author_id"
- add_index "issues", ["category_id"], :name => "index_issues_on_category_id"
- add_index "issues", ["created_on"], :name => "index_issues_on_created_on"
- add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id"
- add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id"
- add_index "issues", ["project_id"], :name => "issues_project_id"
- add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt"
- add_index "issues", ["status_id"], :name => "index_issues_on_status_id"
- add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id"
-
- create_table "join_in_competitions", :force => true 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", :force => true 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", :force => true 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"
- end
-
- add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
-
- create_table "journal_details_copy", :force => true 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"
- end
-
- add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
-
- create_table "journal_replies", :id => false, :force => true do |t|
- t.integer "journal_id"
- t.integer "user_id"
- t.integer "reply_id"
- end
-
- add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id"
- add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id"
- add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id"
-
- create_table "journals", :force => true 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
- end
-
- add_index "journals", ["created_on"], :name => "index_journals_on_created_on"
- add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
- add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id"
- add_index "journals", ["user_id"], :name => "index_journals_on_user_id"
-
- create_table "journals_for_messages", :force => true 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"
- end
-
- create_table "kindeditor_assets", :force => true 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 "member_roles", :force => true do |t|
- t.integer "member_id", :null => false
- t.integer "role_id", :null => false
- t.integer "inherited_from"
- end
-
- add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id"
- add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id"
-
- create_table "members", :force => true 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
- end
-
- add_index "members", ["project_id"], :name => "index_members_on_project_id"
- add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
- add_index "members", ["user_id"], :name => "index_members_on_user_id"
-
- create_table "memo_messages", :force => true 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
- end
-
- create_table "memos", :force => true do |t|
- t.integer "forum_id", :null => false
- t.integer "parent_id"
- t.string "subject", :null => false
- t.text "content", :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
- end
-
- create_table "message_alls", :force => true 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
- end
-
- create_table "messages", :force => true do |t|
- t.integer "board_id", :null => false
- t.integer "parent_id"
- t.string "subject", :default => "", :null => false
- t.text "content"
- 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"
- end
-
- add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
- add_index "messages", ["board_id"], :name => "messages_board_id"
- add_index "messages", ["created_on"], :name => "index_messages_on_created_on"
- add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
- add_index "messages", ["parent_id"], :name => "messages_parent_id"
-
- create_table "news", :force => true 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
- end
-
- add_index "news", ["author_id"], :name => "index_news_on_author_id"
- add_index "news", ["created_on"], :name => "index_news_on_created_on"
- add_index "news", ["project_id"], :name => "news_project_id"
-
- create_table "no_uses", :force => true 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", :force => true 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 "onclick_times", :force => true do |t|
- t.integer "user_id"
- t.datetime "onclick_time"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "open_id_authentication_associations", :force => true 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", :force => true do |t|
- t.integer "timestamp", :null => false
- t.string "server_url"
- t.string "salt", :null => false
- end
-
- create_table "open_source_projects", :force => true 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 "option_numbers", :force => true 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", :force => true 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", :force => true do |t|
- t.integer "organization_id"
- t.integer "course_id"
- t.datetime "created_at"
- end
-
- create_table "org_document_comments", :force => true 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
- end
-
- create_table "org_member_roles", :force => true do |t|
- t.integer "org_member_id"
- t.integer "role_id"
- end
-
- create_table "org_members", :force => true 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_projects", :force => true do |t|
- t.integer "organization_id"
- t.integer "project_id"
- t.datetime "created_at"
- end
-
- create_table "organizations", :force => true do |t|
- t.string "name"
- t.text "description"
- t.integer "creator_id"
- t.integer "home_id"
- t.string "domain"
- t.boolean "is_public"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "phone_app_versions", :force => true do |t|
- t.string "version"
- t.text "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "poll_answers", :force => true 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
- end
-
- create_table "poll_questions", :force => true do |t|
- t.string "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"
- end
-
- create_table "poll_users", :force => true do |t|
- t.integer "user_id"
- t.integer "poll_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "poll_votes", :force => true do |t|
- t.integer "user_id"
- t.integer "poll_question_id"
- t.integer "poll_answer_id"
- t.text "vote_text"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "polls", :force => true do |t|
- t.string "polls_name"
- t.string "polls_type"
- t.integer "polls_group_id"
- t.integer "polls_status"
- t.integer "user_id"
- t.datetime "published_at"
- t.datetime "closed_at"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.text "polls_description"
- t.integer "show_result", :default => 1
- end
-
- create_table "praise_tread_caches", :force => true 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", :force => true 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"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "principal_activities", :force => true 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 "project_infos", :force => true 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_scores", :force => true 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
- end
-
- create_table "project_statuses", :force => true 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
- end
-
- add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade"
-
- create_table "projecting_softapplictions", :force => true 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", :force => true 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"
- end
-
- add_index "projects", ["lft"], :name => "index_projects_on_lft"
- add_index "projects", ["rgt"], :name => "index_projects_on_rgt"
-
- create_table "projects_trackers", :id => false, :force => true do |t|
- t.integer "project_id", :default => 0, :null => false
- t.integer "tracker_id", :default => 0, :null => false
- end
-
- add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true
- add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
-
- create_table "queries", :force => true 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"
- end
-
- add_index "queries", ["project_id"], :name => "index_queries_on_project_id"
- add_index "queries", ["user_id"], :name => "index_queries_on_user_id"
-
- create_table "relative_memo_to_open_source_projects", :force => true 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", :force => true 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 "repositories", :force => true 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
- end
-
- add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
-
- create_table "rich_rich_files", :force => true 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", :force => true 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 "schools", :force => true 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"
- end
-
- create_table "seems_rateable_cached_ratings", :force => true do |t|
- t.integer "cacheable_id", :limit => 8
- 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", :force => true do |t|
- t.integer "rater_id", :limit => 8
- 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", :force => true do |t|
- t.string "name", :default => "", :null => false
- t.text "value"
- t.datetime "updated_on"
- end
-
- add_index "settings", ["name"], :name => "index_settings_on_name"
-
- create_table "shares", :force => true 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 "softapplications", :force => true 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 "student_work_tests", :force => true 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"
- end
-
- create_table "student_works", :force => true do |t|
- t.string "name"
- t.text "description", :limit => 2147483647
- 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
- end
-
- create_table "student_works_evaluation_distributions", :force => true do |t|
- t.integer "student_work_id"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "student_works_scores", :force => true do |t|
- t.integer "student_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
- end
-
- create_table "students_for_courses", :force => true do |t|
- t.integer "student_id"
- t.integer "course_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
- add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
-
- create_table "system_messages", :force => true 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 "taggings", :force => true 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"
- end
-
- add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
- add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
- add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type"
-
- create_table "tags", :force => true do |t|
- t.string "name"
- end
-
- create_table "teachers", :force => true 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 "time_entries", :force => true 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
- end
-
- add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id"
- add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on"
- add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id"
- add_index "time_entries", ["project_id"], :name => "time_entries_project_id"
- add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id"
-
- create_table "tokens", :force => true 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
- end
-
- add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id"
- add_index "tokens", ["value"], :name => "tokens_value", :unique => true
-
- create_table "trackers", :force => true 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 "user_activities", :force => true 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"
- end
-
- create_table "user_extensions", :force => true 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 => ""
- end
-
- create_table "user_feedback_messages", :force => true 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
- end
-
- create_table "user_grades", :force => true 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
- end
-
- add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade"
- add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id"
- add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id"
-
- create_table "user_levels", :force => true do |t|
- t.integer "user_id"
- t.integer "level"
- end
-
- create_table "user_preferences", :force => true do |t|
- t.integer "user_id", :default => 0, :null => false
- t.text "others"
- t.boolean "hide_mail", :default => false
- t.string "time_zone"
- end
-
- add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id"
-
- create_table "user_score_details", :force => true 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", :force => true 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_statuses", :force => true 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
- end
-
- add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count"
- add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
- add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
-
- create_table "users", :force => true 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, :default => "", :null => false
- 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"
- end
-
- add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
- add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
- add_index "users", ["type"], :name => "index_users_on_type"
-
- create_table "versions", :force => true 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
- end
-
- add_index "versions", ["project_id"], :name => "versions_project_id"
- add_index "versions", ["sharing"], :name => "index_versions_on_sharing"
-
- create_table "visitors", :force => true do |t|
- t.integer "user_id"
- t.integer "master_id"
- t.datetime "updated_on"
- t.datetime "created_on"
- end
-
- add_index "visitors", ["master_id"], :name => "index_visitors_master_id"
- add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on"
- add_index "visitors", ["user_id"], :name => "index_visitors_user_id"
-
- create_table "watchers", :force => true do |t|
- t.string "watchable_type", :default => "", :null => false
- t.integer "watchable_id", :default => 0, :null => false
- t.integer "user_id"
- end
-
- add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type"
- add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id"
- add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type"
-
- create_table "web_footer_companies", :force => true 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", :force => true do |t|
- t.string "name"
- t.text "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "wiki_content_versions", :force => true do |t|
- t.integer "wiki_content_id", :null => false
- t.integer "page_id", :null => false
- t.integer "author_id"
- t.binary "data", :limit => 2147483647
- t.string "compression", :limit => 6, :default => ""
- t.string "comments", :default => ""
- t.datetime "updated_on", :null => false
- t.integer "version", :null => false
- end
-
- add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on"
- add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid"
-
- create_table "wiki_contents", :force => true do |t|
- t.integer "page_id", :null => false
- t.integer "author_id"
- t.text "text", :limit => 2147483647
- t.string "comments", :default => ""
- t.datetime "updated_on", :null => false
- t.integer "version", :null => false
- end
-
- add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id"
- add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id"
-
- create_table "wiki_pages", :force => true 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"
- end
-
- add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id"
- add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title"
- add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id"
-
- create_table "wiki_redirects", :force => true do |t|
- t.integer "wiki_id", :null => false
- t.string "title"
- t.string "redirects_to"
- t.datetime "created_on", :null => false
- end
-
- add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title"
- add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id"
-
- create_table "wikis", :force => true do |t|
- t.integer "project_id", :null => false
- t.string "start_page", :null => false
- t.integer "status", :default => 1, :null => false
- end
-
- add_index "wikis", ["project_id"], :name => "wikis_project_id"
-
- create_table "workflows", :force => true 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
- end
-
- add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id"
- add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id"
- add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
- add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id"
-
- create_table "works_categories", :force => true do |t|
- t.string "category"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "zip_packs", :force => true 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.integer "pack_size", :default => 0
- t.text "file_digests"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
-end
->>>>>>> szzh
+=======
+# encoding: UTF-8
+# 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 to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20151127011351) do
+
+ create_table "activities", :force => true 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"
+ end
+
+ add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type"
+ add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
+ add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
+
+ create_table "activity_notifies", :force => true 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"
+ end
+
+ add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id"
+ add_index "activity_notifies", ["created_on"], :name => "index_an_created_on"
+ add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to"
+
+ create_table "api_keys", :force => true 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
+ end
+
+ add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
+ add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
+
+ create_table "applied_projects", :force => true do |t|
+ t.integer "project_id", :null => false
+ t.integer "user_id", :null => false
+ end
+
+ create_table "apply_project_masters", :force => true 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 "attachments", :force => true 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 => 40, :default => "", :null => false
+ t.integer "downloads", :default => 0, :null => false
+ t.integer "author_id", :default => 0, :null => false
+ t.datetime "created_on"
+ t.string "description"
+ t.string "disk_directory"
+ t.integer "attachtype", :default => 1
+ t.integer "is_public", :default => 1
+ t.integer "copy_from"
+ t.integer "quotes"
+ end
+
+ add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
+ add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
+ add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
+
+ create_table "attachmentstypes", :force => true do |t|
+ t.integer "typeId", :null => false
+ t.string "typeName", :limit => 50
+ end
+
+ create_table "auth_sources", :force => true 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"
+ end
+
+ add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type"
+
+ create_table "biding_projects", :force => true 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", :force => true 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", :force => true 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
+ end
+
+ create_table "blogs", :force => true 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
+ end
+
+ create_table "boards", :force => true 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"
+ t.integer "course_id"
+ end
+
+ add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
+ add_index "boards", ["project_id"], :name => "boards_project_id"
+
+ create_table "bug_to_osps", :force => true 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 "changes", :force => true 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"
+ end
+
+ add_index "changes", ["changeset_id"], :name => "changesets_changeset_id"
+
+ create_table "changeset_parents", :id => false, :force => true do |t|
+ t.integer "changeset_id", :null => false
+ t.integer "parent_id", :null => false
+ end
+
+ add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids"
+ add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
+
+ create_table "changesets", :force => true 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"
+ end
+
+ add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
+ add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true
+ add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid"
+ add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id"
+ add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id"
+
+ create_table "changesets_issues", :id => false, :force => true do |t|
+ t.integer "changeset_id", :null => false
+ t.integer "issue_id", :null => false
+ end
+
+ add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
+
+ create_table "code_review_assignments", :force => true 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", :force => true 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", :force => true 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", :force => true 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 "comments", :force => true 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
+ end
+
+ add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
+ add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
+
+ create_table "contest_notifications", :force => true do |t|
+ t.text "title"
+ t.text "content"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "contesting_projects", :force => true do |t|
+ t.integer "project_id"
+ t.string "contest_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 "contesting_softapplications", :force => true do |t|
+ t.integer "softapplication_id"
+ t.integer "contest_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 "contestnotifications", :force => true do |t|
+ t.integer "contest_id"
+ t.string "title"
+ t.string "summary"
+ t.text "description"
+ t.integer "author_id"
+ t.integer "notificationcomments_count"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "contests", :force => true do |t|
+ t.string "name"
+ t.string "budget", :default => ""
+ t.integer "author_id"
+ t.date "deadline"
+ t.string "description"
+ t.integer "commit"
+ t.string "password"
+ t.datetime "created_on", :null => false
+ t.datetime "updated_on", :null => false
+ end
+
+ create_table "course_activities", :force => true 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
+ end
+
+ create_table "course_attachments", :force => true 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_contributor_scores", :force => true do |t|
+ t.integer "course_id"
+ t.integer "user_id"
+ t.integer "message_num"
+ t.integer "message_reply_num"
+ t.integer "news_reply_num"
+ t.integer "resource_num"
+ t.integer "journal_num"
+ t.integer "journal_reply_num"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.integer "total_score"
+ end
+
+ create_table "course_groups", :force => true do |t|
+ t.string "name"
+ t.integer "course_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "course_infos", :force => true 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_messages", :force => true 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.string "content"
+ t.integer "status"
+ end
+
+ create_table "course_statuses", :force => true 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 "courses", :force => true 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.string "class_period"
+ 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
+ end
+
+ create_table "custom_fields", :force => true 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
+ end
+
+ add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type"
+
+ create_table "custom_fields_projects", :id => false, :force => true do |t|
+ t.integer "custom_field_id", :default => 0, :null => false
+ t.integer "project_id", :default => 0, :null => false
+ end
+
+ add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true
+
+ create_table "custom_fields_trackers", :id => false, :force => true do |t|
+ t.integer "custom_field_id", :default => 0, :null => false
+ t.integer "tracker_id", :default => 0, :null => false
+ end
+
+ add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true
+
+ create_table "custom_values", :force => true 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"
+ end
+
+ add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id"
+ add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
+
+ create_table "delayed_jobs", :force => true 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"
+ end
+
+ add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
+
+ create_table "discuss_demos", :force => true do |t|
+ t.string "title"
+ t.text "body"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "documents", :force => true 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
+ end
+
+ add_index "documents", ["category_id"], :name => "index_documents_on_category_id"
+ add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
+ add_index "documents", ["project_id"], :name => "documents_project_id"
+
+ create_table "dts", :force => true do |t|
+ t.string "IPLineCode"
+ t.string "Description"
+ t.string "Num"
+ t.string "Variable"
+ t.string "TraceInfo"
+ t.string "Method"
+ t.string "File"
+ t.string "IPLine"
+ t.string "Review"
+ t.string "Category"
+ t.string "Defect"
+ t.string "PreConditions"
+ t.string "StartLine"
+ t.integer "project_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "enabled_modules", :force => true do |t|
+ t.integer "project_id"
+ t.string "name", :null => false
+ t.integer "course_id"
+ end
+
+ add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id"
+
+ create_table "enumerations", :force => true 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
+ end
+
+ add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
+ add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
+
+ create_table "exercise_answers", :force => true do |t|
+ t.integer "user_id"
+ 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
+ end
+
+ create_table "exercise_choices", :force => true 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
+ end
+
+ create_table "exercise_questions", :force => true 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.integer "question_score"
+ end
+
+ create_table "exercise_standard_answers", :force => true 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
+ end
+
+ create_table "exercise_users", :force => true do |t|
+ t.integer "user_id"
+ t.integer "exercise_id"
+ t.integer "score"
+ t.datetime "start_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.datetime "end_at"
+ t.integer "status"
+ end
+
+ create_table "exercises", :force => true do |t|
+ t.text "exercise_name"
+ t.text "exercise_description"
+ t.integer "course_id"
+ t.integer "exercise_status"
+ t.integer "user_id"
+ t.integer "time"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.datetime "publish_time"
+ t.datetime "end_time"
+ t.integer "show_result"
+ end
+
+ create_table "first_pages", :force => true 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", :force => true 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
+ end
+
+ add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id"
+
+ create_table "forge_messages", :force => true 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"
+ end
+
+ create_table "forums", :force => true 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"
+ end
+
+ create_table "groups_users", :id => false, :force => true do |t|
+ t.integer "group_id", :null => false
+ t.integer "user_id", :null => false
+ end
+
+ add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
+
+ create_table "homework_attaches", :force => true 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
+ end
+
+ add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
+
+ create_table "homework_commons", :force => true do |t|
+ t.string "name"
+ t.integer "user_id"
+ t.text "description"
+ t.date "publish_time"
+ t.date "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
+ end
+
+ create_table "homework_detail_manuals", :force => true do |t|
+ t.float "ta_proportion"
+ t.integer "comment_status"
+ t.date "evaluation_start"
+ t.date "evaluation_end"
+ t.integer "evaluation_num"
+ t.integer "absence_penalty", :default => 1
+ t.integer "homework_common_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "homework_detail_programings", :force => true do |t|
+ t.string "language"
+ t.text "standard_code", :limit => 2147483647
+ 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", :force => true 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", :force => true do |t|
+ t.integer "course_id"
+ t.integer "bid_id"
+ end
+
+ add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
+ add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
+
+ create_table "homework_tests", :force => true 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", :force => true 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 "invite_lists", :force => true 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", :force => true do |t|
+ t.integer "project_id", :default => 0, :null => false
+ t.string "name", :limit => 30, :default => "", :null => false
+ t.integer "assigned_to_id"
+ end
+
+ add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id"
+ add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
+
+ create_table "issue_relations", :force => true 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"
+ end
+
+ add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true
+ add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id"
+ add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id"
+
+ create_table "issue_statuses", :force => true 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"
+ end
+
+ add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed"
+ add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default"
+ add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position"
+
+ create_table "issues", :force => true 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"
+ end
+
+ add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id"
+ add_index "issues", ["author_id"], :name => "index_issues_on_author_id"
+ add_index "issues", ["category_id"], :name => "index_issues_on_category_id"
+ add_index "issues", ["created_on"], :name => "index_issues_on_created_on"
+ add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id"
+ add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id"
+ add_index "issues", ["project_id"], :name => "issues_project_id"
+ add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt"
+ add_index "issues", ["status_id"], :name => "index_issues_on_status_id"
+ add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id"
+
+ create_table "join_in_competitions", :force => true 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", :force => true 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", :force => true 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"
+ end
+
+ add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
+
+ create_table "journal_details_copy", :force => true 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"
+ end
+
+ add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
+
+ create_table "journal_replies", :id => false, :force => true do |t|
+ t.integer "journal_id"
+ t.integer "user_id"
+ t.integer "reply_id"
+ end
+
+ add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id"
+ add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id"
+ add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id"
+
+ create_table "journals", :force => true 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
+ end
+
+ add_index "journals", ["created_on"], :name => "index_journals_on_created_on"
+ add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
+ add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id"
+ add_index "journals", ["user_id"], :name => "index_journals_on_user_id"
+
+ create_table "journals_for_messages", :force => true 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"
+ end
+
+ create_table "kindeditor_assets", :force => true 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 "member_roles", :force => true do |t|
+ t.integer "member_id", :null => false
+ t.integer "role_id", :null => false
+ t.integer "inherited_from"
+ end
+
+ add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id"
+ add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id"
+
+ create_table "members", :force => true 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
+ end
+
+ add_index "members", ["project_id"], :name => "index_members_on_project_id"
+ add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
+ add_index "members", ["user_id"], :name => "index_members_on_user_id"
+
+ create_table "memo_messages", :force => true 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
+ end
+
+ create_table "memos", :force => true do |t|
+ t.integer "forum_id", :null => false
+ t.integer "parent_id"
+ t.string "subject", :null => false
+ t.text "content", :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
+ end
+
+ create_table "message_alls", :force => true 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
+ end
+
+ create_table "messages", :force => true do |t|
+ t.integer "board_id", :null => false
+ t.integer "parent_id"
+ t.string "subject", :default => "", :null => false
+ t.text "content"
+ 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"
+ end
+
+ add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
+ add_index "messages", ["board_id"], :name => "messages_board_id"
+ add_index "messages", ["created_on"], :name => "index_messages_on_created_on"
+ add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
+ add_index "messages", ["parent_id"], :name => "messages_parent_id"
+
+ create_table "news", :force => true 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
+ end
+
+ add_index "news", ["author_id"], :name => "index_news_on_author_id"
+ add_index "news", ["created_on"], :name => "index_news_on_created_on"
+ add_index "news", ["project_id"], :name => "news_project_id"
+
+ create_table "no_uses", :force => true 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", :force => true 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 "onclick_times", :force => true do |t|
+ t.integer "user_id"
+ t.datetime "onclick_time"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "open_id_authentication_associations", :force => true 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", :force => true do |t|
+ t.integer "timestamp", :null => false
+ t.string "server_url"
+ t.string "salt", :null => false
+ end
+
+ create_table "open_source_projects", :force => true 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 "option_numbers", :force => true 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", :force => true 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", :force => true do |t|
+ t.integer "organization_id"
+ t.integer "course_id"
+ t.datetime "created_at"
+ end
+
+ create_table "org_document_comments", :force => true 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
+ end
+
+ create_table "org_member_roles", :force => true do |t|
+ t.integer "org_member_id"
+ t.integer "role_id"
+ end
+
+ create_table "org_members", :force => true 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_projects", :force => true do |t|
+ t.integer "organization_id"
+ t.integer "project_id"
+ t.datetime "created_at"
+ end
+
+ create_table "organizations", :force => true do |t|
+ t.string "name"
+ t.text "description"
+ t.integer "creator_id"
+ t.integer "home_id"
+ t.string "domain"
+ t.boolean "is_public"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "phone_app_versions", :force => true do |t|
+ t.string "version"
+ t.text "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "poll_answers", :force => true 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
+ end
+
+ create_table "poll_questions", :force => true do |t|
+ t.string "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"
+ end
+
+ create_table "poll_users", :force => true do |t|
+ t.integer "user_id"
+ t.integer "poll_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "poll_votes", :force => true do |t|
+ t.integer "user_id"
+ t.integer "poll_question_id"
+ t.integer "poll_answer_id"
+ t.text "vote_text"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "polls", :force => true do |t|
+ t.string "polls_name"
+ t.string "polls_type"
+ t.integer "polls_group_id"
+ t.integer "polls_status"
+ t.integer "user_id"
+ t.datetime "published_at"
+ t.datetime "closed_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ t.text "polls_description"
+ t.integer "show_result", :default => 1
+ end
+
+ create_table "praise_tread_caches", :force => true 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", :force => true 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"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "principal_activities", :force => true 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 "project_infos", :force => true 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_scores", :force => true 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
+ end
+
+ create_table "project_statuses", :force => true 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
+ end
+
+ add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade"
+
+ create_table "projecting_softapplictions", :force => true 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", :force => true 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"
+ end
+
+ add_index "projects", ["lft"], :name => "index_projects_on_lft"
+ add_index "projects", ["rgt"], :name => "index_projects_on_rgt"
+
+ create_table "projects_trackers", :id => false, :force => true do |t|
+ t.integer "project_id", :default => 0, :null => false
+ t.integer "tracker_id", :default => 0, :null => false
+ end
+
+ add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true
+ add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
+
+ create_table "queries", :force => true 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"
+ end
+
+ add_index "queries", ["project_id"], :name => "index_queries_on_project_id"
+ add_index "queries", ["user_id"], :name => "index_queries_on_user_id"
+
+ create_table "relative_memo_to_open_source_projects", :force => true 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", :force => true 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 "repositories", :force => true 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
+ end
+
+ add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
+
+ create_table "rich_rich_files", :force => true 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", :force => true 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 "schools", :force => true 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"
+ end
+
+ create_table "seems_rateable_cached_ratings", :force => true do |t|
+ t.integer "cacheable_id", :limit => 8
+ 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", :force => true do |t|
+ t.integer "rater_id", :limit => 8
+ 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", :force => true do |t|
+ t.string "name", :default => "", :null => false
+ t.text "value"
+ t.datetime "updated_on"
+ end
+
+ add_index "settings", ["name"], :name => "index_settings_on_name"
+
+ create_table "shares", :force => true 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 "softapplications", :force => true 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 "student_work_tests", :force => true 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"
+ end
+
+ create_table "student_works", :force => true do |t|
+ t.string "name"
+ t.text "description", :limit => 2147483647
+ 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
+ end
+
+ create_table "student_works_evaluation_distributions", :force => true do |t|
+ t.integer "student_work_id"
+ t.integer "user_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "student_works_scores", :force => true do |t|
+ t.integer "student_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
+ end
+
+ create_table "students_for_courses", :force => true do |t|
+ t.integer "student_id"
+ t.integer "course_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
+ add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
+
+ create_table "system_messages", :force => true 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 "taggings", :force => true 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"
+ end
+
+ add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
+ add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
+ add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type"
+
+ create_table "tags", :force => true do |t|
+ t.string "name"
+ end
+
+ create_table "teachers", :force => true 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 "time_entries", :force => true 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
+ end
+
+ add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id"
+ add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on"
+ add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id"
+ add_index "time_entries", ["project_id"], :name => "time_entries_project_id"
+ add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id"
+
+ create_table "tokens", :force => true 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
+ end
+
+ add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id"
+ add_index "tokens", ["value"], :name => "tokens_value", :unique => true
+
+ create_table "trackers", :force => true 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 "user_activities", :force => true 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"
+ end
+
+ create_table "user_extensions", :force => true 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 => ""
+ end
+
+ create_table "user_feedback_messages", :force => true 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
+ end
+
+ create_table "user_grades", :force => true 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
+ end
+
+ add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade"
+ add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id"
+ add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id"
+
+ create_table "user_levels", :force => true do |t|
+ t.integer "user_id"
+ t.integer "level"
+ end
+
+ create_table "user_preferences", :force => true do |t|
+ t.integer "user_id", :default => 0, :null => false
+ t.text "others"
+ t.boolean "hide_mail", :default => false
+ t.string "time_zone"
+ end
+
+ add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id"
+
+ create_table "user_score_details", :force => true 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", :force => true 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_statuses", :force => true 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
+ end
+
+ add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count"
+ add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
+ add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
+
+ create_table "users", :force => true 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, :default => "", :null => false
+ 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"
+ end
+
+ add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
+ add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
+ add_index "users", ["type"], :name => "index_users_on_type"
+
+ create_table "versions", :force => true 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
+ end
+
+ add_index "versions", ["project_id"], :name => "versions_project_id"
+ add_index "versions", ["sharing"], :name => "index_versions_on_sharing"
+
+ create_table "visitors", :force => true do |t|
+ t.integer "user_id"
+ t.integer "master_id"
+ t.datetime "updated_on"
+ t.datetime "created_on"
+ end
+
+ add_index "visitors", ["master_id"], :name => "index_visitors_master_id"
+ add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on"
+ add_index "visitors", ["user_id"], :name => "index_visitors_user_id"
+
+ create_table "watchers", :force => true do |t|
+ t.string "watchable_type", :default => "", :null => false
+ t.integer "watchable_id", :default => 0, :null => false
+ t.integer "user_id"
+ end
+
+ add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type"
+ add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id"
+ add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type"
+
+ create_table "web_footer_companies", :force => true 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", :force => true do |t|
+ t.string "name"
+ t.text "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "wiki_content_versions", :force => true do |t|
+ t.integer "wiki_content_id", :null => false
+ t.integer "page_id", :null => false
+ t.integer "author_id"
+ t.binary "data", :limit => 2147483647
+ t.string "compression", :limit => 6, :default => ""
+ t.string "comments", :default => ""
+ t.datetime "updated_on", :null => false
+ t.integer "version", :null => false
+ end
+
+ add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on"
+ add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid"
+
+ create_table "wiki_contents", :force => true do |t|
+ t.integer "page_id", :null => false
+ t.integer "author_id"
+ t.text "text", :limit => 2147483647
+ t.string "comments", :default => ""
+ t.datetime "updated_on", :null => false
+ t.integer "version", :null => false
+ end
+
+ add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id"
+ add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id"
+
+ create_table "wiki_pages", :force => true 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"
+ end
+
+ add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id"
+ add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title"
+ add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id"
+
+ create_table "wiki_redirects", :force => true do |t|
+ t.integer "wiki_id", :null => false
+ t.string "title"
+ t.string "redirects_to"
+ t.datetime "created_on", :null => false
+ end
+
+ add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title"
+ add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id"
+
+ create_table "wikis", :force => true do |t|
+ t.integer "project_id", :null => false
+ t.string "start_page", :null => false
+ t.integer "status", :default => 1, :null => false
+ end
+
+ add_index "wikis", ["project_id"], :name => "wikis_project_id"
+
+ create_table "workflows", :force => true 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
+ end
+
+ add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id"
+ add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id"
+ add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
+ add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id"
+
+ create_table "works_categories", :force => true do |t|
+ t.string "category"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ create_table "zip_packs", :force => true 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.integer "pack_size", :default => 0
+ t.text "file_digests"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+end
From e728dd55ebecc33c9b2792df3c7439f2ec331543 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 19:02:07 +0800
Subject: [PATCH 15/21] Merge branch 'szzh' into dev_zanle
Conflicts:
app/models/attachment.rb
db/schema.rb
---
app/models/project.rb | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/app/models/project.rb b/app/models/project.rb
index 847c536da..c68e73369 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1217,18 +1217,30 @@ class Project < ActiveRecord::Base
def create_project_ealasticsearch_index
- if self.is_public == 1
+ if self.is_public
self.__elasticsearch__.index_document
end
end
def update_project_ealasticsearch_index
- if self.is_public == 1
- self.__elasticsearch__.update_document
+ if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
+ begin
+ self.__elasticsearch__.update_document
+ rescue => e
+ self.__elasticsearch__.index_document
+ end
+ else #如果是更新成为私有的,那么索引就要被删除
+ begin
+ self.__elasticsearch__.delete_document
+ rescue => e
+
+ end
end
end
def delete_project_ealasticsearch_index
- if self.is_public == 1
- self.__elasticsearch__.delete_document
+ begin
+ self.__elasticsearch__.delete_document
+ rescue => e
+
end
end
From 34ac56e0a0f94734e9bf861a61ebf6d5c1ce4332 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 27 Nov 2015 19:07:10 +0800
Subject: [PATCH 16/21] attachment index_document
---
app/models/attachment.rb | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index ebabbf944..aa436965b 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -612,14 +612,21 @@ class Attachment < ActiveRecord::Base
if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) ||
( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
self.container_type == 'Principal')
+ begin
self.__elasticsearch__.update_document
+ rescue => e
+ end
+ else
+ begin
+ self.__elasticsearch__.delete_document
+ rescue => e
+ end
end
end
def delete_attachment_ealasticsearch_index
- if self.is_public == 1 && ( (self.container_type == 'Project' && Project.find(self.container_id).is_public == 1) ||
- ( self.container_type == 'Course' && Course.find(self.container_id).is_public == 1) ||
- self.container_type == 'Principal')
+ begin
self.__elasticsearch__.delete_document
+ rescue => e
end
end
end
From 1c3bff0007c1bcdca9d6b095f3c6054580cdc29f Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Mon, 30 Nov 2015 10:39:50 +0800
Subject: [PATCH 17/21] =?UTF-8?q?=E8=B5=84=E6=BA=90=E5=BA=93=E7=9A=84?=
=?UTF-8?q?=E5=88=A0=E9=99=A4bug=20=E5=92=8C=E5=8F=B3=E9=94=AE=E8=8F=9C?=
=?UTF-8?q?=E5=8D=95=E7=9A=84bug=20=E5=92=8C=E5=8F=98=E8=83=8C=E6=99=AF?=
=?UTF-8?q?=E8=89=B2=E7=9A=84bug?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 4 +-
.../users/_resource_search_form.html.erb | 2 +-
app/views/users/_resources_list.html.erb | 2 +-
app/views/users/user_resource.html.erb | 49 -------------------
4 files changed, 4 insertions(+), 53 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 8188ce12e..9ff833f48 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1367,7 +1367,7 @@ class UsersController < ApplicationController
end
end
- if(params[:type].blank? || params[:type] == "1") #全部
+ if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
@@ -1856,7 +1856,7 @@ class UsersController < ApplicationController
# 根据资源关键字进行搜索
def resource_search
search = params[:search].to_s.strip.downcase
- if(params[:type].nil? || params[:type].blank? || params[:type] == "1") #全部
+ if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源 取交集并查询
@attachments = Attachment.where("((author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
diff --git a/app/views/users/_resource_search_form.html.erb b/app/views/users/_resource_search_form.html.erb
index 376007fec..c629f9f32 100644
--- a/app/views/users/_resource_search_form.html.erb
+++ b/app/views/users/_resource_search_form.html.erb
@@ -1,7 +1,7 @@
<%= form_tag( url_for(:controller => 'users',:action => 'resource_search',:id=>user.id),
:remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %>
- <%= hidden_field_tag(:type,type) %>
+ <%= hidden_field_tag(:type,type.nil? ? 1 : type) %>
<%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index 156da0f07..ef6397ec0 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -5,7 +5,7 @@
<% else %>
<% attachments.each do |attach| %>
-
+
-
diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb
index 4fd4d0cb9..3af9c29fd 100644
--- a/app/views/users/user_resource.html.erb
+++ b/app/views/users/user_resource.html.erb
@@ -480,54 +480,5 @@
lastSendType = sendType;
}
- // var iWidth = document.documentElement.clientWidth;
- // var iHeight = document.documentElement.clientHeight;
- // var moveX = 0;
- // var moveY = 0;
- // var moveTop = 0;
- // var moveLeft = 0;
- // var moveable = false;
- // var docMouseMoveEvent = document.onmousemove;
- // var docMouseUpEvent = document.onmouseup;
- // $("#upload_box").mousedown(function() {
- // var evt = getEvent();
- // moveable = true;
- // moveX = evt.clientX;
- // moveY = evt.clientY;
- //
- // moveTop = parseInt($("#upload_box").css('top'));
- // moveLeft = parseInt($("#upload_box").css('left'));
- //
- // $(document).mousemove( function() {
- // if (moveable) {
- // var evt = getEvent();
- // var x = moveLeft + evt.clientX - moveX;
- // var y = moveTop + evt.clientY - moveY;
- // if ( x > 0 &&( x + 322 < iWidth) && y > 0 && (y + 257 < iHeight) ) {
- // $("#upload_box").css('left', x + "px");
- // $("#upload_box").css('top', y + "px");
- // console.log( moveX)
- // console.log( moveY)
- // }
- // }
- // });
- // $(document).mouseup (function () {
- // if (moveable) {
- // document.onmousemove = docMouseMoveEvent;
- // document.onmouseup = docMouseUpEvent;
- // moveable = false;
- // moveX = 0;
- // moveY = 0;
- // moveTop = 0;
- // moveLeft = 0;
- // }
- // });
- // });
- //
- // // 获得事件Event对象,用于兼容IE和FireFox
- // function getEvent() {
- // return window.event || arguments.callee.caller.arguments[0];
- // }
-
From d2662375900d483d37b79082796357bea715a3b1 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Mon, 30 Nov 2015 11:08:08 +0800
Subject: [PATCH 18/21] =?UTF-8?q?=09kaminari=E5=88=86=E9=A1=B5=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A0=E4=B8=8A=E4=B8=80=E9=A1=B5=E4=B8=8B=E4=B8=80=E9=A1=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/kaminari/_last_page.html.erb | 2 +-
app/views/kaminari/_paginator.html.erb | 4 +-
app/views/kaminari/_prev_page.html.erb | 2 +-
db/schema.rb | 1818 ------------------------
4 files changed, 4 insertions(+), 1822 deletions(-)
diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb
index d1a9089d1..a853f3dcc 100644
--- a/app/views/kaminari/_last_page.html.erb
+++ b/app/views/kaminari/_last_page.html.erb
@@ -7,5 +7,5 @@
remote: data-remote
-%>
- <%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote %>
+ <%= link_to_unless false, t('views.pagination.last').html_safe, url, :remote => remote %>
diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb
index 9a2a02ab9..b14a1f0a1 100644
--- a/app/views/kaminari/_paginator.html.erb
+++ b/app/views/kaminari/_paginator.html.erb
@@ -8,7 +8,7 @@
-%>
<%= paginator.render do -%>
- <%= prev_page_tag unless current_page.first? %>
+ <%= prev_page_tag %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= page_tag page %>
@@ -16,7 +16,7 @@
<%= gap_tag %>
<% end -%>
<% end -%>
- <%= next_page_tag unless current_page.last? %>
+ <%= next_page_tag %>
<% end -%>
diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb
index 693977716..7bce1c2b4 100644
--- a/app/views/kaminari/_prev_page.html.erb
+++ b/app/views/kaminari/_prev_page.html.erb
@@ -7,6 +7,6 @@
remote: data-remote
-%>
-
- <%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote ,:class=>"previous c_blue"%>
+ <%= link_to_unless false, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote ,:class=>"previous c_blue"%>
diff --git a/db/schema.rb b/db/schema.rb
index 0d4135f3d..f154a71e8 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1,1821 +1,3 @@
-
-# encoding: UTF-8
-# 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 to check this file into your version control system.
-
-ActiveRecord::Schema.define(:version => 20151117075939) do
-
- create_table "activities", :force => true 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"
- end
-
- add_index "activities", ["act_id", "act_type"], :name => "index_activities_on_act_id_and_act_type"
- add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
- add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
-
- create_table "activity_notifies", :force => true 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"
- end
-
- add_index "activity_notifies", ["activity_container_id", "activity_container_type"], :name => "index_an_activity_container_id"
- add_index "activity_notifies", ["created_on"], :name => "index_an_created_on"
- add_index "activity_notifies", ["notify_to"], :name => "index_an_notify_to"
-
- create_table "api_keys", :force => true 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
- end
-
- add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
- add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
-
- create_table "applied_projects", :force => true do |t|
- t.integer "project_id", :null => false
- t.integer "user_id", :null => false
- end
-
- create_table "apply_project_masters", :force => true 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 "attachments", :force => true 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 => 40, :default => "", :null => false
- t.integer "downloads", :default => 0, :null => false
- t.integer "author_id", :default => 0, :null => false
- t.datetime "created_on"
- t.string "description"
- t.string "disk_directory"
- t.integer "attachtype", :default => 1
- t.integer "is_public", :default => 1
- t.integer "copy_from"
- t.integer "quotes"
- end
-
- add_index "attachments", ["author_id"], :name => "index_attachments_on_author_id"
- add_index "attachments", ["container_id", "container_type"], :name => "index_attachments_on_container_id_and_container_type"
- add_index "attachments", ["created_on"], :name => "index_attachments_on_created_on"
-
- create_table "attachmentstypes", :force => true do |t|
- t.integer "typeId", :null => false
- t.string "typeName", :limit => 50
- end
-
- create_table "auth_sources", :force => true 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"
- end
-
- add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type"
-
- create_table "biding_projects", :force => true 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", :force => true 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", :force => true 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
- end
-
- create_table "blogs", :force => true 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
- end
-
- create_table "boards", :force => true 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"
- t.integer "course_id"
- end
-
- add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id"
- add_index "boards", ["project_id"], :name => "boards_project_id"
-
- create_table "bug_to_osps", :force => true 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 "changes", :force => true 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"
- end
-
- add_index "changes", ["changeset_id"], :name => "changesets_changeset_id"
-
- create_table "changeset_parents", :id => false, :force => true do |t|
- t.integer "changeset_id", :null => false
- t.integer "parent_id", :null => false
- end
-
- add_index "changeset_parents", ["changeset_id"], :name => "changeset_parents_changeset_ids"
- add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
-
- create_table "changesets", :force => true 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"
- end
-
- add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
- add_index "changesets", ["repository_id", "revision"], :name => "changesets_repos_rev", :unique => true
- add_index "changesets", ["repository_id", "scmid"], :name => "changesets_repos_scmid"
- add_index "changesets", ["repository_id"], :name => "index_changesets_on_repository_id"
- add_index "changesets", ["user_id"], :name => "index_changesets_on_user_id"
-
- create_table "changesets_issues", :id => false, :force => true do |t|
- t.integer "changeset_id", :null => false
- t.integer "issue_id", :null => false
- end
-
- add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
-
- create_table "code_review_assignments", :force => true 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", :force => true 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", :force => true 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", :force => true 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 "comments", :force => true 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
- end
-
- add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
- add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
-
- create_table "contest_notifications", :force => true do |t|
- t.text "title"
- t.text "content"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "contesting_projects", :force => true do |t|
- t.integer "project_id"
- t.string "contest_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 "contesting_softapplications", :force => true do |t|
- t.integer "softapplication_id"
- t.integer "contest_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 "contestnotifications", :force => true do |t|
- t.integer "contest_id"
- t.string "title"
- t.string "summary"
- t.text "description"
- t.integer "author_id"
- t.integer "notificationcomments_count"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "contests", :force => true do |t|
- t.string "name"
- t.string "budget", :default => ""
- t.integer "author_id"
- t.date "deadline"
- t.string "description"
- t.integer "commit"
- t.string "password"
- t.datetime "created_on", :null => false
- t.datetime "updated_on", :null => false
- end
-
- create_table "course_activities", :force => true 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
- end
-
- create_table "course_attachments", :force => true 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_groups", :force => true do |t|
- t.string "name"
- t.integer "course_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "course_infos", :force => true 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_messages", :force => true 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.string "content"
- t.integer "status"
- end
-
- create_table "course_statuses", :force => true 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 "courses", :force => true 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.string "class_period"
- 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
- end
-
- create_table "custom_fields", :force => true 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
- end
-
- add_index "custom_fields", ["id", "type"], :name => "index_custom_fields_on_id_and_type"
-
- create_table "custom_fields_projects", :id => false, :force => true do |t|
- t.integer "custom_field_id", :default => 0, :null => false
- t.integer "project_id", :default => 0, :null => false
- end
-
- add_index "custom_fields_projects", ["custom_field_id", "project_id"], :name => "index_custom_fields_projects_on_custom_field_id_and_project_id", :unique => true
-
- create_table "custom_fields_trackers", :id => false, :force => true do |t|
- t.integer "custom_field_id", :default => 0, :null => false
- t.integer "tracker_id", :default => 0, :null => false
- end
-
- add_index "custom_fields_trackers", ["custom_field_id", "tracker_id"], :name => "index_custom_fields_trackers_on_custom_field_id_and_tracker_id", :unique => true
-
- create_table "custom_values", :force => true 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"
- end
-
- add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id"
- add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
-
- create_table "delayed_jobs", :force => true 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"
- end
-
- add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
-
- create_table "discuss_demos", :force => true do |t|
- t.string "title"
- t.text "body"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "documents", :force => true 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
- end
-
- add_index "documents", ["category_id"], :name => "index_documents_on_category_id"
- add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
- add_index "documents", ["project_id"], :name => "documents_project_id"
-
- create_table "dts", :force => true do |t|
- t.string "IPLineCode"
- t.string "Description"
- t.string "Num"
- t.string "Variable"
- t.string "TraceInfo"
- t.string "Method"
- t.string "File"
- t.string "IPLine"
- t.string "Review"
- t.string "Category"
- t.string "Defect"
- t.string "PreConditions"
- t.string "StartLine"
- t.integer "project_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "enabled_modules", :force => true do |t|
- t.integer "project_id"
- t.string "name", :null => false
- t.integer "course_id"
- end
-
- add_index "enabled_modules", ["project_id"], :name => "enabled_modules_project_id"
-
- create_table "enumerations", :force => true 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
- end
-
- add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
- add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
-
- create_table "first_pages", :force => true 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", :force => true 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
- end
-
- add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id"
-
- create_table "forge_messages", :force => true 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"
- end
-
- create_table "forums", :force => true 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"
- end
-
- create_table "groups_users", :id => false, :force => true do |t|
- t.integer "group_id", :null => false
- t.integer "user_id", :null => false
- end
-
- add_index "groups_users", ["group_id", "user_id"], :name => "groups_users_ids", :unique => true
-
- create_table "homework_attaches", :force => true 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
- end
-
- add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
-
- create_table "homework_commons", :force => true do |t|
- t.string "name"
- t.integer "user_id"
- t.text "description"
- t.date "publish_time"
- t.date "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
- end
-
- create_table "homework_detail_manuals", :force => true do |t|
- t.float "ta_proportion"
- t.integer "comment_status"
- t.date "evaluation_start"
- t.date "evaluation_end"
- t.integer "evaluation_num"
- t.integer "absence_penalty", :default => 1
- t.integer "homework_common_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "homework_detail_programings", :force => true do |t|
- t.string "language"
- t.text "standard_code", :limit => 2147483647
- 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", :force => true 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", :force => true do |t|
- t.integer "course_id"
- t.integer "bid_id"
- end
-
- add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
- add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
-
- create_table "homework_tests", :force => true 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", :force => true 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 "invite_lists", :force => true 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", :force => true do |t|
- t.integer "project_id", :default => 0, :null => false
- t.string "name", :limit => 30, :default => "", :null => false
- t.integer "assigned_to_id"
- end
-
- add_index "issue_categories", ["assigned_to_id"], :name => "index_issue_categories_on_assigned_to_id"
- add_index "issue_categories", ["project_id"], :name => "issue_categories_project_id"
-
- create_table "issue_relations", :force => true 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"
- end
-
- add_index "issue_relations", ["issue_from_id", "issue_to_id"], :name => "index_issue_relations_on_issue_from_id_and_issue_to_id", :unique => true
- add_index "issue_relations", ["issue_from_id"], :name => "index_issue_relations_on_issue_from_id"
- add_index "issue_relations", ["issue_to_id"], :name => "index_issue_relations_on_issue_to_id"
-
- create_table "issue_statuses", :force => true 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"
- end
-
- add_index "issue_statuses", ["is_closed"], :name => "index_issue_statuses_on_is_closed"
- add_index "issue_statuses", ["is_default"], :name => "index_issue_statuses_on_is_default"
- add_index "issue_statuses", ["position"], :name => "index_issue_statuses_on_position"
-
- create_table "issues", :force => true 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"
- end
-
- add_index "issues", ["assigned_to_id"], :name => "index_issues_on_assigned_to_id"
- add_index "issues", ["author_id"], :name => "index_issues_on_author_id"
- add_index "issues", ["category_id"], :name => "index_issues_on_category_id"
- add_index "issues", ["created_on"], :name => "index_issues_on_created_on"
- add_index "issues", ["fixed_version_id"], :name => "index_issues_on_fixed_version_id"
- add_index "issues", ["priority_id"], :name => "index_issues_on_priority_id"
- add_index "issues", ["project_id"], :name => "issues_project_id"
- add_index "issues", ["root_id", "lft", "rgt"], :name => "index_issues_on_root_id_and_lft_and_rgt"
- add_index "issues", ["status_id"], :name => "index_issues_on_status_id"
- add_index "issues", ["tracker_id"], :name => "index_issues_on_tracker_id"
-
- create_table "join_in_competitions", :force => true 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", :force => true 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", :force => true 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"
- end
-
- add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
-
- create_table "journal_details_copy", :force => true 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"
- end
-
- add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
-
- create_table "journal_replies", :id => false, :force => true do |t|
- t.integer "journal_id"
- t.integer "user_id"
- t.integer "reply_id"
- end
-
- add_index "journal_replies", ["journal_id"], :name => "index_journal_replies_on_journal_id"
- add_index "journal_replies", ["reply_id"], :name => "index_journal_replies_on_reply_id"
- add_index "journal_replies", ["user_id"], :name => "index_journal_replies_on_user_id"
-
- create_table "journals", :force => true 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
- end
-
- add_index "journals", ["created_on"], :name => "index_journals_on_created_on"
- add_index "journals", ["journalized_id", "journalized_type"], :name => "journals_journalized_id"
- add_index "journals", ["journalized_id"], :name => "index_journals_on_journalized_id"
- add_index "journals", ["user_id"], :name => "index_journals_on_user_id"
-
- create_table "journals_for_messages", :force => true 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"
- end
-
- create_table "kindeditor_assets", :force => true 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 "member_roles", :force => true do |t|
- t.integer "member_id", :null => false
- t.integer "role_id", :null => false
- t.integer "inherited_from"
- end
-
- add_index "member_roles", ["member_id"], :name => "index_member_roles_on_member_id"
- add_index "member_roles", ["role_id"], :name => "index_member_roles_on_role_id"
-
- create_table "members", :force => true 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
- end
-
- add_index "members", ["project_id"], :name => "index_members_on_project_id"
- add_index "members", ["user_id", "project_id", "course_id"], :name => "index_members_on_user_id_and_project_id", :unique => true
- add_index "members", ["user_id"], :name => "index_members_on_user_id"
-
- create_table "memo_messages", :force => true 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
- end
-
- create_table "memos", :force => true do |t|
- t.integer "forum_id", :null => false
- t.integer "parent_id"
- t.string "subject", :null => false
- t.text "content", :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
- end
-
- create_table "message_alls", :force => true 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
- end
-
- create_table "messages", :force => true do |t|
- t.integer "board_id", :null => false
- t.integer "parent_id"
- t.string "subject", :default => "", :null => false
- t.text "content"
- 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"
- end
-
- add_index "messages", ["author_id"], :name => "index_messages_on_author_id"
- add_index "messages", ["board_id"], :name => "messages_board_id"
- add_index "messages", ["created_on"], :name => "index_messages_on_created_on"
- add_index "messages", ["last_reply_id"], :name => "index_messages_on_last_reply_id"
- add_index "messages", ["parent_id"], :name => "messages_parent_id"
-
- create_table "news", :force => true 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
- end
-
- add_index "news", ["author_id"], :name => "index_news_on_author_id"
- add_index "news", ["created_on"], :name => "index_news_on_created_on"
- add_index "news", ["project_id"], :name => "news_project_id"
-
- create_table "no_uses", :force => true 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", :force => true 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 "onclick_times", :force => true do |t|
- t.integer "user_id"
- t.datetime "onclick_time"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "open_id_authentication_associations", :force => true 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", :force => true do |t|
- t.integer "timestamp", :null => false
- t.string "server_url"
- t.string "salt", :null => false
- end
-
- create_table "open_source_projects", :force => true 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 "option_numbers", :force => true 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", :force => true 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", :force => true do |t|
- t.integer "organization_id"
- t.integer "course_id"
- t.datetime "created_at"
- end
-
- create_table "org_document_comments", :force => true do |t|
- t.string "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
- end
-
- create_table "org_member_roles", :force => true do |t|
- t.integer "org_member_id"
- t.integer "role_id"
- end
-
- create_table "org_members", :force => true 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_projects", :force => true do |t|
- t.integer "organization_id"
- t.integer "project_id"
- t.datetime "created_at"
- end
-
- create_table "organizations", :force => true do |t|
- t.string "name"
- t.text "description"
- t.integer "creator_id"
- t.integer "home_id"
- t.string "domain"
- t.boolean "is_public"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "phone_app_versions", :force => true do |t|
- t.string "version"
- t.text "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "poll_answers", :force => true 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
- end
-
- create_table "poll_questions", :force => true do |t|
- t.string "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"
- end
-
- create_table "poll_users", :force => true do |t|
- t.integer "user_id"
- t.integer "poll_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "poll_votes", :force => true do |t|
- t.integer "user_id"
- t.integer "poll_question_id"
- t.integer "poll_answer_id"
- t.text "vote_text"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "polls", :force => true do |t|
- t.string "polls_name"
- t.string "polls_type"
- t.integer "polls_group_id"
- t.integer "polls_status"
- t.integer "user_id"
- t.datetime "published_at"
- t.datetime "closed_at"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.text "polls_description"
- t.integer "show_result", :default => 1
- end
-
- create_table "praise_tread_caches", :force => true 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", :force => true 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"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "principal_activities", :force => true 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 "project_infos", :force => true 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_scores", :force => true 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
- end
-
- create_table "project_statuses", :force => true 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
- end
-
- add_index "project_statuses", ["grade"], :name => "index_project_statuses_on_grade"
-
- create_table "projecting_softapplictions", :force => true 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", :force => true 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"
- end
-
- add_index "projects", ["lft"], :name => "index_projects_on_lft"
- add_index "projects", ["rgt"], :name => "index_projects_on_rgt"
-
- create_table "projects_trackers", :id => false, :force => true do |t|
- t.integer "project_id", :default => 0, :null => false
- t.integer "tracker_id", :default => 0, :null => false
- end
-
- add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true
- add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id"
-
- create_table "queries", :force => true 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"
- end
-
- add_index "queries", ["project_id"], :name => "index_queries_on_project_id"
- add_index "queries", ["user_id"], :name => "index_queries_on_user_id"
-
- create_table "relative_memo_to_open_source_projects", :force => true 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", :force => true 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 "repositories", :force => true 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
- end
-
- add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
-
- create_table "rich_rich_files", :force => true 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", :force => true 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 "schools", :force => true 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"
- end
-
- create_table "seems_rateable_cached_ratings", :force => true do |t|
- t.integer "cacheable_id", :limit => 8
- 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", :force => true do |t|
- t.integer "rater_id", :limit => 8
- 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", :force => true do |t|
- t.string "name", :default => "", :null => false
- t.text "value"
- t.datetime "updated_on"
- end
-
- add_index "settings", ["name"], :name => "index_settings_on_name"
-
- create_table "shares", :force => true 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 "softapplications", :force => true 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 "student_work_tests", :force => true 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"
- end
-
- create_table "student_works", :force => true do |t|
- t.string "name"
- t.text "description", :limit => 2147483647
- 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
- end
-
- create_table "student_works_evaluation_distributions", :force => true do |t|
- t.integer "student_work_id"
- t.integer "user_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "student_works_scores", :force => true do |t|
- t.integer "student_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
- end
-
- create_table "students_for_courses", :force => true do |t|
- t.integer "student_id"
- t.integer "course_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- add_index "students_for_courses", ["course_id"], :name => "index_students_for_courses_on_course_id"
- add_index "students_for_courses", ["student_id"], :name => "index_students_for_courses_on_student_id"
-
- create_table "system_messages", :force => true 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 "taggings", :force => true 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"
- end
-
- add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
- add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
- add_index "taggings", ["taggable_type"], :name => "index_taggings_on_taggable_type"
-
- create_table "tags", :force => true do |t|
- t.string "name"
- end
-
- create_table "teachers", :force => true 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 "time_entries", :force => true 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
- end
-
- add_index "time_entries", ["activity_id"], :name => "index_time_entries_on_activity_id"
- add_index "time_entries", ["created_on"], :name => "index_time_entries_on_created_on"
- add_index "time_entries", ["issue_id"], :name => "time_entries_issue_id"
- add_index "time_entries", ["project_id"], :name => "time_entries_project_id"
- add_index "time_entries", ["user_id"], :name => "index_time_entries_on_user_id"
-
- create_table "tokens", :force => true 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
- end
-
- add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id"
- add_index "tokens", ["value"], :name => "tokens_value", :unique => true
-
- create_table "trackers", :force => true 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 "user_activities", :force => true 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"
- end
-
- create_table "user_extensions", :force => true 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 => ""
- end
-
- create_table "user_feedback_messages", :force => true 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
- end
-
- create_table "user_grades", :force => true 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
- end
-
- add_index "user_grades", ["grade"], :name => "index_user_grades_on_grade"
- add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id"
- add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id"
-
- create_table "user_levels", :force => true do |t|
- t.integer "user_id"
- t.integer "level"
- end
-
- create_table "user_preferences", :force => true do |t|
- t.integer "user_id", :default => 0, :null => false
- t.text "others"
- t.boolean "hide_mail", :default => false
- t.string "time_zone"
- end
-
- add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id"
-
- create_table "user_score_details", :force => true 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", :force => true 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_statuses", :force => true 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
- end
-
- add_index "user_statuses", ["changesets_count"], :name => "index_user_statuses_on_changesets_count"
- add_index "user_statuses", ["grade"], :name => "index_user_statuses_on_grade"
- add_index "user_statuses", ["watchers_count"], :name => "index_user_statuses_on_watchers_count"
-
- create_table "users", :force => true 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, :default => "", :null => false
- 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"
- end
-
- add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"
- add_index "users", ["id", "type"], :name => "index_users_on_id_and_type"
- add_index "users", ["type"], :name => "index_users_on_type"
-
- create_table "versions", :force => true 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
- end
-
- add_index "versions", ["project_id"], :name => "versions_project_id"
- add_index "versions", ["sharing"], :name => "index_versions_on_sharing"
-
- create_table "visitors", :force => true do |t|
- t.integer "user_id"
- t.integer "master_id"
- t.datetime "updated_on"
- t.datetime "created_on"
- end
-
- add_index "visitors", ["master_id"], :name => "index_visitors_master_id"
- add_index "visitors", ["updated_on"], :name => "index_visitors_updated_on"
- add_index "visitors", ["user_id"], :name => "index_visitors_user_id"
-
- create_table "watchers", :force => true do |t|
- t.string "watchable_type", :default => "", :null => false
- t.integer "watchable_id", :default => 0, :null => false
- t.integer "user_id"
- end
-
- add_index "watchers", ["user_id", "watchable_type"], :name => "watchers_user_id_type"
- add_index "watchers", ["user_id"], :name => "index_watchers_on_user_id"
- add_index "watchers", ["watchable_id", "watchable_type"], :name => "index_watchers_on_watchable_id_and_watchable_type"
-
- create_table "web_footer_companies", :force => true 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", :force => true do |t|
- t.string "name"
- t.text "description"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "wiki_content_versions", :force => true do |t|
- t.integer "wiki_content_id", :null => false
- t.integer "page_id", :null => false
- t.integer "author_id"
- t.binary "data", :limit => 2147483647
- t.string "compression", :limit => 6, :default => ""
- t.string "comments", :default => ""
- t.datetime "updated_on", :null => false
- t.integer "version", :null => false
- end
-
- add_index "wiki_content_versions", ["updated_on"], :name => "index_wiki_content_versions_on_updated_on"
- add_index "wiki_content_versions", ["wiki_content_id"], :name => "wiki_content_versions_wcid"
-
- create_table "wiki_contents", :force => true do |t|
- t.integer "page_id", :null => false
- t.integer "author_id"
- t.text "text", :limit => 2147483647
- t.string "comments", :default => ""
- t.datetime "updated_on", :null => false
- t.integer "version", :null => false
- end
-
- add_index "wiki_contents", ["author_id"], :name => "index_wiki_contents_on_author_id"
- add_index "wiki_contents", ["page_id"], :name => "wiki_contents_page_id"
-
- create_table "wiki_pages", :force => true 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"
- end
-
- add_index "wiki_pages", ["parent_id"], :name => "index_wiki_pages_on_parent_id"
- add_index "wiki_pages", ["wiki_id", "title"], :name => "wiki_pages_wiki_id_title"
- add_index "wiki_pages", ["wiki_id"], :name => "index_wiki_pages_on_wiki_id"
-
- create_table "wiki_redirects", :force => true do |t|
- t.integer "wiki_id", :null => false
- t.string "title"
- t.string "redirects_to"
- t.datetime "created_on", :null => false
- end
-
- add_index "wiki_redirects", ["wiki_id", "title"], :name => "wiki_redirects_wiki_id_title"
- add_index "wiki_redirects", ["wiki_id"], :name => "index_wiki_redirects_on_wiki_id"
-
- create_table "wikis", :force => true do |t|
- t.integer "project_id", :null => false
- t.string "start_page", :null => false
- t.integer "status", :default => 1, :null => false
- end
-
- add_index "wikis", ["project_id"], :name => "wikis_project_id"
-
- create_table "workflows", :force => true 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
- end
-
- add_index "workflows", ["new_status_id"], :name => "index_workflows_on_new_status_id"
- add_index "workflows", ["old_status_id"], :name => "index_workflows_on_old_status_id"
- add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
- add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id"
-
- create_table "works_categories", :force => true do |t|
- t.string "category"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
- create_table "zip_packs", :force => true 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.integer "pack_size", :default => 0
- t.text "file_digests"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- end
-
-end
-=======
# encoding: UTF-8
# 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
From 62399b6d72f48754d40b86c38db8471d48509f4c Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Mon, 30 Nov 2015 11:21:21 +0800
Subject: [PATCH 19/21] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=AF=BE=E7=A8=8B?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=BB=93=E6=9E=9C=E6=B7=BB=E5=8A=A0=20?=
=?UTF-8?q?=E6=A0=87=E7=AD=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/welcome/_search_all_results.html.erb | 11 +++++++++--
app/views/welcome/_search_attachment_results.html.erb | 6 +++++-
app/views/welcome/_search_course_results.html.erb | 6 +++++-
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/app/views/welcome/_search_all_results.html.erb b/app/views/welcome/_search_all_results.html.erb
index 98dc39ba7..014c6b487 100644
--- a/app/views/welcome/_search_all_results.html.erb
+++ b/app/views/welcome/_search_all_results.html.erb
@@ -28,7 +28,11 @@
-
@@ -41,7 +45,10 @@
-
-
-
From 96b704e191f70bcd7dc16e76584b0c3ff8c6b29c Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Mon, 30 Nov 2015 12:55:19 +0800
Subject: [PATCH 20/21] =?UTF-8?q?=E6=89=80=E6=9C=89=E8=80=85=E7=9A=84?=
=?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E9=97=B4=E9=9A=8F=E7=9D=80=E8=A2=AB?=
=?UTF-8?q?=E6=8B=A5=E6=9C=89=E8=80=85=E7=9A=84=E6=94=B9=E5=8F=98=E8=80=8C?=
=?UTF-8?q?=E6=94=B9=E5=A4=A9=20=E8=AD=AC=E5=A6=82course=20=E9=87=8C?=
=?UTF-8?q?=E8=BE=B9=E8=BF=99=E4=B9=88=E5=86=99=EF=BC=9Ahas=5Fmany=20:boar?=
=?UTF-8?q?ds=20boards=E9=87=8C=E8=BE=B9=E8=BF=99=E4=B9=88=E5=86=99?=
=?UTF-8?q?=E5=B0=B1ok:belongs=5Fto=20:course,:touch=3D>true?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/board.rb | 2 +-
app/models/comment.rb | 2 +-
app/models/exercise.rb | 1 +
app/models/journals_for_message.rb | 2 +-
app/models/news.rb | 2 +-
5 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/app/models/board.rb b/app/models/board.rb
index 35a7a72d1..67d59e599 100644
--- a/app/models/board.rb
+++ b/app/models/board.rb
@@ -18,7 +18,7 @@
class Board < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :project,:touch => true
- belongs_to :course
+ belongs_to :course,:touch=>true
has_many :topics, :class_name => 'Message', :conditions => "#{Message.table_name}.parent_id IS NULL", :order => "#{Message.table_name}.created_on DESC"
has_many :messages, :dependent => :destroy, :order => "#{Message.table_name}.created_on DESC"
belongs_to :last_message, :class_name => 'Message', :foreign_key => :last_message_id
diff --git a/app/models/comment.rb b/app/models/comment.rb
index 9de25c50d..0830d8fdd 100644
--- a/app/models/comment.rb
+++ b/app/models/comment.rb
@@ -31,7 +31,7 @@ class Comment < ActiveRecord::Base
:title=>Proc.new {|o| "RE: #{o.commented.title}" },
:url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.commented.id} }
- belongs_to :commented, :polymorphic => true, :counter_cache => true
+ belongs_to :commented, :polymorphic => true, :counter_cache => true,:touch => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
validates_presence_of :commented, :author, :comments
safe_attributes 'comments'
diff --git a/app/models/exercise.rb b/app/models/exercise.rb
index e4295971e..d23e8f115 100644
--- a/app/models/exercise.rb
+++ b/app/models/exercise.rb
@@ -2,6 +2,7 @@ class Exercise < ActiveRecord::Base
#exercise_status: 1,新建;2,发布;3,关闭
include Redmine::SafeAttributes
belongs_to :user
+ belongs_to :course ,:touch => true
has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number"
has_many :exercise_users, :dependent => :destroy
has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index 20b3c60bf..ec6390408 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -24,7 +24,7 @@ class JournalsForMessage < ActiveRecord::Base
:conditions => "#{self.table_name}.jour_type = 'Project' ",:touch => true
belongs_to :course,
- :foreign_key => 'jour_id'
+ :foreign_key => 'jour_id',:touch=>true
belongs_to :jour, :polymorphic => true
diff --git a/app/models/news.rb b/app/models/news.rb
index aa5d6df1f..53581a536 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -21,7 +21,7 @@ class News < ActiveRecord::Base
include ApplicationHelper
has_many_kindeditor_assets :assets, :dependent => :destroy
#added by nwb
- belongs_to :course
+ belongs_to :course,:touch => true
belongs_to :author, :class_name => 'User', :foreign_key => 'author_id'
has_many :comments, :as => :commented, :dependent => :destroy, :order => "created_on"
# fq
From 29a8d1b9f537e01346d0b449cbd4820da8995e75 Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Mon, 30 Nov 2015 13:22:01 +0800
Subject: [PATCH 21/21] tip
---
app/views/layouts/_logined_header.html.erb | 2 +-
app/views/layouts/_unlogin_header.html.erb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index bf1166021..bb99a5ea2 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -54,7 +54,7 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
- " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索"/>
+ " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索公开的课程,项目,用户,以及资源"/>
diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb
index 1f1fb9016..ba05cf50c 100644
--- a/app/views/layouts/_unlogin_header.html.erb
+++ b/app/views/layouts/_unlogin_header.html.erb
@@ -52,7 +52,7 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
- " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" onkeypress="search_in_header_I(event,$(this));"/>
+ " id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索公开的课程,项目,用户,以及资源" onkeypress="search_in_header_I(event,$(this));"/>