aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2013-10-18 17:06:58 +0200
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2013-10-18 17:06:58 +0200
commitffe6ace0cd34f32e531281494427f84d047c2a2a (patch)
treece404718a58b7d8d832736e2d31b53dae6d0b2b3
parent42bd6b8bd3536dba0e756b8c8e0b9ae7dfcd94f6 (diff)
downloadsonarqube-ffe6ace0cd34f32e531281494427f84d047c2a2a.tar.gz
sonarqube-ffe6ace0cd34f32e531281494427f84d047c2a2a.zip
SONAR-4416 Migrate existing timeline widgets to adapt to new render code
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java2
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb44
3 files changed, 46 insertions, 1 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
index 198de205dea..49d3e990ea2 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
@@ -33,7 +33,7 @@ import java.util.List;
*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 443;
+ public static final int LAST_VERSION = 444;
public static enum Status {
UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
index c713289a7a9..1ffcfbd5558 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
@@ -181,6 +181,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('440');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('441');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('442');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('443');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('444');
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;
diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb
new file mode 100644
index 00000000000..e84a3027a03
--- /dev/null
+++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/444_resize_timeline_widgets.rb
@@ -0,0 +1,44 @@
+#
+# 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 4.0
+# SONAR-4416 - Migrate saved timeline chart heights to adapt to new render code (chartHeight += 100)
+#
+
+class ResizeTimelineWidgets < ActiveRecord::Migration
+
+ class Widget < ActiveRecord::Base
+ end
+
+ class WidgetProperty < ActiveRecord::Base
+ end
+
+ def self.up
+ Widget.reset_column_information
+ WidgetProperty.reset_column_information
+
+ Widget.find(:all, :conditions => { :widget_key => 'timeline' }).each do |widget|
+ WidgetProperty.find(:all, :conditions => { :widget_id => widget.id, :kee => 'chartHeight' }).each do |property|
+ property.update_attributes!(:text_value => (property.read_attribute(:text_value).to_i + 100).to_s)
+ end
+ end
+ end
+end