From 747e52172260bb174fbfecb8f7248e488920c85a Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sun, 9 Dec 2012 20:32:39 +0100 Subject: [PATCH] Fix backward-compatibility of db migration with 3.4 milestone 5 --- .../core/persistence/DatabaseVersion.java | 2 +- .../org/sonar/core/persistence/rows-h2.sql | 44 +------------------ .../WEB-INF/app/models/measure_filter.rb | 4 ++ ...b => 360_move_existing_measure_filters.rb} | 1 - ..._widgets.rb => 361_move_filter_widgets.rb} | 4 +- ...er_tables.rb => 362_drop_filter_tables.rb} | 0 6 files changed, 8 insertions(+), 47 deletions(-) rename sonar-server/src/main/webapp/WEB-INF/db/migrate/{357_move_existing_measure_filters.rb => 360_move_existing_measure_filters.rb} (99%) rename sonar-server/src/main/webapp/WEB-INF/db/migrate/{360_move_filter_widgets.rb => 361_move_filter_widgets.rb} (91%) rename sonar-server/src/main/webapp/WEB-INF/db/migrate/{361_drop_filter_tables.rb => 362_drop_filter_tables.rb} (100%) 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 17380180b3e..d0323b072a2 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 @@ -32,7 +32,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 361; + public static final int LAST_VERSION = 362; 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 605577c00cb..9d94ebc041a 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 @@ -26,66 +26,24 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('2'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('10'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('11'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('13'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('14'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('16'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('35'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('36'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('39'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('41'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('46'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('48'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('49'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('51'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('52'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('53'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('54'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('55'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('57'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('58'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('59'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('60'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('61'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('62'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('66'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('68'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('69'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('72'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('73'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('75'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('76'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('77'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('78'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('79'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('80'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('81'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('82'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('84'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('85'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('86'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('87'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('88'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('89'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('90'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('91'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('92'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('93'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('94'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('95'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('96'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('97'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('98'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('99'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('100'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('101'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('110'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('111'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('112'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('113'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('114'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('115'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('116'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('117'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('118'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('119'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('120'); @@ -184,11 +142,11 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('353'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('354'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('355'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('356'); -INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('357'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('358'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('359'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('360'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('361'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('362'); 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/app/models/measure_filter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb index de0c2d546d4..db90a4b5853 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_filter.rb @@ -95,6 +95,10 @@ class MeasureFilter < ActiveRecord::Base @require_links end + def require_authentication? + criteria[:onFavourites]=='true' + end + def criteria(key=nil) @criteria ||= HashWithIndifferentAccess.new if key diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/357_move_existing_measure_filters.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_existing_measure_filters.rb similarity index 99% rename from sonar-server/src/main/webapp/WEB-INF/db/migrate/357_move_existing_measure_filters.rb rename to sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_existing_measure_filters.rb index 7906ec0af08..57e4a334e46 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/357_move_existing_measure_filters.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_existing_measure_filters.rb @@ -68,7 +68,6 @@ class MoveExistingMeasureFilters < ActiveRecord::Migration new_filter.data = data.join('|') unless data.empty? new_filter.save - Filter.delete(old_filter.id) end def self.move_columns(old_filter, data) diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_filter_widgets.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/361_move_filter_widgets.rb similarity index 91% rename from sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_filter_widgets.rb rename to sonar-server/src/main/webapp/WEB-INF/db/migrate/361_move_filter_widgets.rb index 1b30481a7a7..12d88b0e74a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/360_move_filter_widgets.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/361_move_filter_widgets.rb @@ -51,9 +51,9 @@ class MoveFilterWidgets < ActiveRecord::Migration filter = MeasureFilter.find(:first, :conditions => ['name=? and user_id=?', old_filter.name, old_filter.user_id]) if old_filter.user_id filter = MeasureFilter.find(:first, :conditions => ['name=? and user_id is null', old_filter.name]) unless filter if filter - widget_property.text_value = filter.id.to_s + widget_property.text_value=filter.id.to_s widget_property.save - widget.widget_key = (filter.data.include?('display=treemap') ? 'measure_filter_treemap' : 'measure_filter_list') + widget.widget_key=(filter.data.include?('display=treemap') ? 'measure_filter_treemap' : 'measure_filter_list') widget.save end end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/361_drop_filter_tables.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/362_drop_filter_tables.rb similarity index 100% rename from sonar-server/src/main/webapp/WEB-INF/db/migrate/361_drop_filter_tables.rb rename to sonar-server/src/main/webapp/WEB-INF/db/migrate/362_drop_filter_tables.rb -- 2.39.5