aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-07-17 10:13:17 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-07-17 10:15:32 +0200
commit48697451f2b0ba517c7d1861af3897b4ace896f9 (patch)
tree99d6e30a0a7dcfddadaf7e57c32e126366e89431 /sonar-db
parent7f79ec13b5773949e5eb3e12da1b18cec2d086e7 (diff)
downloadsonarqube-48697451f2b0ba517c7d1861af3897b4ace896f9.tar.gz
sonarqube-48697451f2b0ba517c7d1861af3897b4ace896f9.zip
SONAR-6716 remove data migrations of v4.4
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/java/org/sonar/db/MyBatis.java3
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java2
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v44/ChangeLog.java118
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v44/Migration44Mapper.java63
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v44/ProfileMeasure.java50
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v44/QProfileDto44.java60
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/v44/package-info.java25
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/version/v44/Migration44Mapper.xml105
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v44/ChangeLogTest.java37
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/v44/ProfileMeasureTest.java37
10 files changed, 2 insertions, 498 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/MyBatis.java b/sonar-db/src/main/java/org/sonar/db/MyBatis.java
index e1a6fd9dfd9..d068c8fcf06 100644
--- a/sonar-db/src/main/java/org/sonar/db/MyBatis.java
+++ b/sonar-db/src/main/java/org/sonar/db/MyBatis.java
@@ -137,7 +137,6 @@ import org.sonar.db.user.UserMapper;
import org.sonar.db.user.UserRoleDto;
import org.sonar.db.version.SchemaMigrationDto;
import org.sonar.db.version.SchemaMigrationMapper;
-import org.sonar.db.version.v44.Migration44Mapper;
import org.sonar.db.version.v45.Migration45Mapper;
import org.sonar.db.version.v50.Migration50Mapper;
@@ -245,7 +244,7 @@ public class MyBatis {
DuplicationMapper.class,
IssueMapper.class, IssueChangeMapper.class, IssueFilterMapper.class, IssueFilterFavouriteMapper.class,
IsAliveMapper.class,
- LoadedTemplateMapper.class, MeasureFilterMapper.class, Migration44Mapper.class, PermissionTemplateMapper.class, PropertiesMapper.class, PurgeMapper.class,
+ LoadedTemplateMapper.class, MeasureFilterMapper.class, PermissionTemplateMapper.class, PropertiesMapper.class, PurgeMapper.class,
ResourceKeyUpdaterMapper.class, ResourceIndexMapper.class, RoleMapper.class, RuleMapper.class,
SchemaMigrationMapper.class, UserMapper.class, GroupMapper.class, UserGroupMapper.class, WidgetMapper.class, WidgetPropertyMapper.class,
FileSourceMapper.class, ActionPlanMapper.class,
diff --git a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java
index f28a4378b04..db0a87e060f 100644
--- a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java
+++ b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java
@@ -36,7 +36,7 @@ public class DatabaseVersion {
* versions must be previously upgraded to LTS version.
* Note that the value can't be less than current LTS version.
*/
- public static final int MIN_UPGRADE_VERSION = 440;
+ public static final int MIN_UPGRADE_VERSION = 600;
/**
* List of all the tables.
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/ChangeLog.java b/sonar-db/src/main/java/org/sonar/db/version/v44/ChangeLog.java
deleted file mode 100644
index 6306bb7704c..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v44/ChangeLog.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.
- */
-package org.sonar.db.version.v44;
-
-import java.util.Date;
-
-/**
- * SONAR-5329
- * Transition ActiveRuleChanges to ActivityLog
- * <p/>
- * Used in the Active Record Migration 548.
- *
- * @since 4.4
- */
-public class ChangeLog {
-
- private int id;
- private Date createdAt;
- private int severity;
- private String paramKey;
- private String paramValue;
- private String userLogin;
- private String ruleKey;
- private String repository;
- private String profileKey;
-
- public ChangeLog() {
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public int getSeverity() {
- return severity;
- }
-
- public void setSeverity(int severity) {
- this.severity = severity;
- }
-
- public Date getCreatedAt() {
- return createdAt;
- }
-
- public void setCreatedAt(Date createdAt) {
- this.createdAt = createdAt;
- }
-
- public String getParamKey() {
- return paramKey;
- }
-
- public void setParamKey(String paramKey) {
- this.paramKey = paramKey;
- }
-
- public String getParamValue() {
- return paramValue;
- }
-
- public void setParamValue(String paramValue) {
- this.paramValue = paramValue;
- }
-
- public String getUserLogin() {
- return userLogin;
- }
-
- public void setUserLogin(String userLogin) {
- this.userLogin = userLogin;
- }
-
- public String getRuleKey() {
- return ruleKey;
- }
-
- public void setRuleKey(String ruleKey) {
- this.ruleKey = ruleKey;
- }
-
- public String getRepository() {
- return repository;
- }
-
- public void setRepository(String repository) {
- this.repository = repository;
- }
-
- public String getProfileKey() {
- return profileKey;
- }
-
- public void setProfileKey(String profileKey) {
- this.profileKey = profileKey;
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/Migration44Mapper.java b/sonar-db/src/main/java/org/sonar/db/version/v44/Migration44Mapper.java
deleted file mode 100644
index 875be56a080..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v44/Migration44Mapper.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.
- */
-package org.sonar.db.version.v44;
-
-import java.util.Date;
-import java.util.List;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nullable;
-import org.apache.ibatis.annotations.Param;
-
-public interface Migration44Mapper {
-
- // migration of measures "profile" and "profile_version"
- List<ProfileMeasure> selectProfileMeasures();
-
- @CheckForNull
- Integer selectProfileVersion(long snapshotId);
-
- @CheckForNull
- Date selectProfileVersionDate(@Param("profileId") int profileId, @Param("profileVersion") int profileVersion);
-
- void updateProfileMeasure(@Param("measureId") long measureId, @Param("json") String json);
-
- void deleteProfileMeasure(long profileMeasureId);
-
- @CheckForNull
- QProfileDto44 selectProfileById(int id);
-
- // creation of columns RULES_PROFILES.CREATED_AT and UPDATED_AT
- List<QProfileDto44> selectAllProfiles();
-
- @CheckForNull
- Date selectProfileCreatedAt(int profileId);
-
- @CheckForNull
- Date selectProfileUpdatedAt(int profileId);
-
- void updateProfileDates(@Param("profileId") int profileId,
- @Param("createdAt") Date createdAt, @Param("updatedAt") Date updatedAt,
- @Param("rulesUpdatedAt") String rulesUpdatedAt);
-
- // migrate changeLog to Activities
- List<ChangeLog> selectActiveRuleChange(@Nullable @Param("enabled") Boolean enabled);
-
- List<Long> selectMeasuresOnDeletedQualityProfiles();
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/ProfileMeasure.java b/sonar-db/src/main/java/org/sonar/db/version/v44/ProfileMeasure.java
deleted file mode 100644
index c3663442a87..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v44/ProfileMeasure.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.
- */
-package org.sonar.db.version.v44;
-
-public class ProfileMeasure {
- private long id;
- private int profileId;
- private long snapshotId;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public int getProfileId() {
- return profileId;
- }
-
- public void setProfileId(int profileId) {
- this.profileId = profileId;
- }
-
- public long getSnapshotId() {
- return snapshotId;
- }
-
- public void setSnapshotId(long snapshotId) {
- this.snapshotId = snapshotId;
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/QProfileDto44.java b/sonar-db/src/main/java/org/sonar/db/version/v44/QProfileDto44.java
deleted file mode 100644
index 7b659f52f13..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v44/QProfileDto44.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.
- */
-package org.sonar.db.version.v44;
-
-public class QProfileDto44 {
-
- private Integer id;
- private String kee;
- private String name;
- private String language;
-
- public Integer getId() {
- return id;
- }
-
- public void setId(Integer id) {
- this.id = id;
- }
-
- public String getKee() {
- return kee;
- }
-
- public void setKee(String kee) {
- this.kee = kee;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getLanguage() {
- return language;
- }
-
- public void setLanguage(String language) {
- this.language = language;
- }
-}
diff --git a/sonar-db/src/main/java/org/sonar/db/version/v44/package-info.java b/sonar-db/src/main/java/org/sonar/db/version/v44/package-info.java
deleted file mode 100644
index 9d07e1f584a..00000000000
--- a/sonar-db/src/main/java/org/sonar/db/version/v44/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.
- */
-
-@ParametersAreNonnullByDefault
-package org.sonar.db.version.v44;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-
diff --git a/sonar-db/src/main/resources/org/sonar/db/version/v44/Migration44Mapper.xml b/sonar-db/src/main/resources/org/sonar/db/version/v44/Migration44Mapper.xml
deleted file mode 100644
index 30bcffddccb..00000000000
--- a/sonar-db/src/main/resources/org/sonar/db/version/v44/Migration44Mapper.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="org.sonar.db.version.v44.Migration44Mapper">
-
- <select id="selectProfileMeasures" resultType="org.sonar.db.version.v44.ProfileMeasure">
- select pm.id as id, pm.value as profileId, pm.snapshot_id as snapshotId
- from project_measures pm
- inner join metrics m on m.id=pm.metric_id and m.name='profile'
- inner join snapshots s on s.islast=${_true} and pm.snapshot_id=s.id and s.scope='PRJ'
- where pm.value is not null
- </select>
-
- <select id="selectProfileVersion" resultType="int" parameterType="long">
- select pm.value from project_measures pm
- inner join metrics m on m.id=pm.metric_id and m.name='profile_version'
- inner join snapshots s on pm.snapshot_id=s.id
- where pm.value is not null and s.id=#{id}
- </select>
-
- <select id="selectProfileById" resultType="org.sonar.db.version.v44.QProfileDto44" parameterType="int">
- select id, kee, name, language
- from rules_profiles
- where id=#{id}
- </select>
-
- <select id="selectProfileVersionDate" resultType="date" parameterType="map">
- select max(change_date) from active_rule_changes
- where profile_id=#{profileId} and profile_version=#{profileVersion}
- </select>
-
- <update id="updateProfileMeasure" parameterType="map">
- update project_measures
- set text_value=#{json}, value=null
- where id=#{measureId}
- </update>
-
- <delete id="deleteProfileMeasure" parameterType="long">
- delete from project_measures where id=#{id}
- </delete>
-
- <select id="selectMeasuresOnDeletedQualityProfiles" resultType="long">
- select pm.id from project_measures pm
- inner join snapshots s on s.id=pm.snapshot_id and s.islast=${_true}
- where
- pm.metric_id=(select id from metrics where name='quality_profiles')
- and pm.value is not null
- </select>
-
- <select id="selectAllProfiles" resultType="org.sonar.db.version.v44.QProfileDto44">
- select id, kee, name, language from rules_profiles
- </select>
-
- <select id="selectProfileUpdatedAt" resultType="date" parameterType="int">
- select max(change_date) from active_rule_changes
- where profile_id=#{id}
- </select>
-
- <select id="selectProfileCreatedAt" resultType="date" parameterType="int">
- select min(change_date) from active_rule_changes
- where profile_id=#{id}
- </select>
-
- <update id="updateProfileDates" parameterType="map">
- update rules_profiles
- set created_at=#{createdAt}, updated_at=#{updatedAt}, rules_updated_at=#{rulesUpdatedAt}
- where id=#{profileId}
- </update>
-
- <select id="selectActiveRuleChange" parameterType="Boolean"
- resultType="org.sonar.db.version.v44.ChangeLog">
- select
- rule_change.id as id,
- rule_change.change_date as createdAt,
- users.login as userLogin,
- rule_def.plugin_name as repository,
- rule_def.plugin_rule_key as ruleKey,
- profile.kee as profileKey,
- rule_change.new_severity as severity ,
- rule_def.name as ruleName,
- rule_def_param.name as paramKey,
- rule_param_change.new_value as paramValue
- from active_rule_changes rule_change
- left join users on users.name = rule_change.username
- left join rules rule_def on rule_def.id = rule_change.rule_id
- left join rules_profiles profile on profile.id = rule_change.profile_id
- left join active_rule_param_changes rule_param_change on rule_param_change.active_rule_change_id = rule_change.id
- left join rules_parameters rule_def_param on rule_param_change.rules_parameter_id = rule_def_param.id
- WHERE
- <choose>
- <when test="enabled != null">
- rule_change.enabled = #{enabled}
- </when>
- <otherwise>
- rule_change.enabled is null
- </otherwise>
- </choose>
- AND profile.name is not null
- AND profile.language is not null
- AND rule_def.plugin_name is not null
- AND rule_def.plugin_name is not null
- order by rule_change.id ASC
- </select>
-</mapper>
-
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v44/ChangeLogTest.java b/sonar-db/src/test/java/org/sonar/db/version/v44/ChangeLogTest.java
deleted file mode 100644
index b260b793146..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v44/ChangeLogTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.
- */
-package org.sonar.db.version.v44;
-
-import org.junit.Test;
-
-import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.allOf;
-
-public class ChangeLogTest {
-
- @Test
- public void test_bean() throws Exception {
- assertThat(ChangeLog.class, allOf(
- hasValidBeanConstructor(),
- hasValidGettersAndSetters()));
- }
-}
diff --git a/sonar-db/src/test/java/org/sonar/db/version/v44/ProfileMeasureTest.java b/sonar-db/src/test/java/org/sonar/db/version/v44/ProfileMeasureTest.java
deleted file mode 100644
index 050408aa4cd..00000000000
--- a/sonar-db/src/test/java/org/sonar/db/version/v44/ProfileMeasureTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 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.
- */
-package org.sonar.db.version.v44;
-
-import org.junit.Test;
-
-import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanConstructor;
-import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.allOf;
-
-public class ProfileMeasureTest {
-
- @Test
- public void test_bean() throws Exception {
- assertThat(ProfileMeasure.class, allOf(
- hasValidBeanConstructor(),
- hasValidGettersAndSetters()));
- }
-}