*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 391;
+ public static final int LAST_VERSION = 392;
public static enum Status {
UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('381');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('382');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('383');
-INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('384');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('387');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('388');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('389');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('390');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('391');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('392');
INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null);
ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
CREATE TABLE "ACTIVE_RULE_CHANGES" (
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
- "USER_NAME" VARCHAR(200),
+ "USERNAME" VARCHAR(200),
"PROFILE_ID" INTEGER NOT NULL,
"PROFILE_VERSION" INTEGER NOT NULL,
"RULE_ID" INTEGER NOT NULL,
.create();
public static final String CLASS_COMPLEXITY_KEY = "class_complexity";
+
+ /**
+ * Information about the cyclomatic complexity per class, calculated by divided the complexity in classes by the number of classes.
+ * If the complexity in classes is not available, the complexity of the file is used.
+ */
public static final Metric CLASS_COMPLEXITY = new Metric.Builder(CLASS_COMPLEXITY_KEY, "Complexity /class", Metric.ValueType.FLOAT)
.setDescription("Complexity average by class")
.setDirection(Metric.DIRECTION_WORST)
import org.sonar.api.database.BaseIdentifiable;
import org.sonar.api.profiles.RulesProfile;
-import javax.persistence.CascadeType;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToMany;
-import javax.persistence.Table;
+import javax.persistence.*;
import java.util.ArrayList;
import java.util.Calendar;
@Table(name = "active_rule_changes")
public class ActiveRuleChange extends BaseIdentifiable {
- @Column(name = "user_name", updatable = false, nullable = true)
+ @Column(name = "username", updatable = false, nullable = true)
private String userName;
@ManyToOne(fetch = FetchType.EAGER)
<tr class="<%= cycle('even', 'odd') -%>">
<td valign="top" width="1%" nowrap><%= change.profile_version - 1 %> -> <%= change.profile_version %></td>
<td valign="top" width="1%" nowrap><%= l(change.change_date) -%></td>
- <td valign="top" width="1%" nowrap><%= change.user_name ? change.user_name : 'System' %></td>
+ <td valign="top" width="1%" nowrap><%= change.username ? change.username : 'System' %></td>
<td valign="top" width="1%" nowrap><%= change.action_text %></td>
<td valign="top"><%= change.rule.name %></td>
<td valign="top">
+++ /dev/null
-#
-# Sonar, entreprise quality control tool.
-# Copyright (C) 2008-2013 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube 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.
-#
-# SonarQube 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 this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-#
-# Sonar 3.6
-#
-class UpdateActiveRuleChangesUserNameToNullable < ActiveRecord::Migration
-
- def self.up
- # Due to some Oracle limitation, we have to update also the limit in order to the change on nullable to be taken in account
- change_column('active_rule_changes', 'user_name', :string, :limit => 201, :null => true)
- end
-
-end
-
--- /dev/null
+#
+# Sonar, entreprise quality control tool.
+# Copyright (C) 2008-2013 SonarSource
+# mailto:contact AT sonarsource DOT com
+#
+# SonarQube 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.
+#
+# SonarQube 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 this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+
+#
+# Sonar 3.6
+#
+class UpdateActiveRuleChangesUserNameToNullable < ActiveRecord::Migration
+
+ class ActiveRuleChange < ActiveRecord::Base
+ end
+
+ def self.up
+ # Due to an issue on Oracle, it's not possible to use change_column to set a column to nullable, we had to create another column
+
+ add_column 'active_rule_changes', 'username', :string, :limit => 200, :null => true
+ ActiveRuleChange.reset_column_information
+ ActiveRuleChange.all.each do |a|
+ a.update_attributes!(:username => a.user_name)
+ end
+
+ remove_column 'active_rule_changes', 'user_name'
+ end
+
+end
\ No newline at end of file