From: Fabrice Bellingard Date: Mon, 4 Apr 2011 20:54:43 +0000 (+0200) Subject: [SONAR-1973] Add first model of review concept X-Git-Tag: 2.8~204 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=816e1b7fe7a090bd607928b2ee13f90a7da52467;p=sonarqube.git [SONAR-1973] Add first model of review concept --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb new file mode 100644 index 00000000000..9f97d1a096f --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/review.rb @@ -0,0 +1,35 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2011 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# +class Review < ActiveRecord::Base + belongs_to :users + belongs_to :rule_failures + belongs_to :projects, :class_name => 'Project', :foreign_key => 'resource_id' + has_many :review_datas, :dependent => :destroy + + + + def inherited? + inheritance=='INHERITED' + end + + def overrides? + inheritance=='OVERRIDES' + end +end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/review_data.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/review_data.rb new file mode 100644 index 00000000000..d4bb18dbc31 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/review_data.rb @@ -0,0 +1,33 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2011 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# +class ReviewData < ActiveRecord::Base + belongs_to :users + belongs_to :reviews + + + + def inherited? + inheritance=='INHERITED' + end + + def overrides? + inheritance=='OVERRIDES' + end +end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/190_create_review.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/190_create_review.rb new file mode 100644 index 00000000000..9a00f93f888 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/190_create_review.rb @@ -0,0 +1,48 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2011 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# + +# +# Sonar 2.8 +# +class CreateReview < ActiveRecord::Migration + + def self.up + create_table 'reviews' do |t| + t.column 'user_id', :integer + t.column 'created_at', :datetime + t.column 'review_type', :string, :limit => 20 + t.column 'status', :string, :limit => 20 + t.column 'severity', :integer, :null => true + t.column 'external_link', :string, :null => true, :limit => 200 + t.column 'rule_failure_id', :integer, :null => true + t.column 'resource_id', :integer, :null => true + t.column 'resource_line', :integer, :null => true + end + + create_table 'review_datas' do |t| + t.column 'user_id', :integer + t.column 'review_id', :integer + t.column 'created_at', :datetime + t.column 'review_text', :string, :limit => 5000 + end + + end + +end