diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-06-26 09:05:43 +0200 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-06-26 09:05:43 +0200 |
commit | 163630e0c9de6278cee233e2d79dfd21fbd9c2c0 (patch) | |
tree | 9c3e260877e84fb53042fdfdcec9c8a0050d276c | |
parent | 68079df6e79b96bead2fd12ae66b1223ca401cbf (diff) | |
download | sonarqube-163630e0c9de6278cee233e2d79dfd21fbd9c2c0.tar.gz sonarqube-163630e0c9de6278cee233e2d79dfd21fbd9c2c0.zip |
SONAR-6634 drop column resource_id from the manual_measures table
22 files changed, 56 insertions, 47 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java index 68d28fb9401..7618cd5d41a 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/CreateAction.java @@ -122,7 +122,6 @@ public class CreateAction implements CustomMeasuresWsAction { UserDoc user = userIndex.getByLogin(userSession.getLogin()); CustomMeasureDto measure = new CustomMeasureDto() .setComponentUuid(component.uuid()) - .setComponentId(component.getId()) .setMetricId(metric.getId()) .setDescription(description) .setUserLogin(user.login()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/DeleteAction.java b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/DeleteAction.java index 1745aae9f17..82fa2fde9e8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/DeleteAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/custom/ws/DeleteAction.java @@ -81,7 +81,7 @@ public class DeleteAction implements CustomMeasuresWsAction { return; } - ComponentDto component = dbClient.componentDao().selectById(customMeasure.getComponentId(), dbSession); + ComponentDto component = dbClient.componentDao().selectByUuid(dbSession, customMeasure.getComponentUuid()); userSession.checkLoggedIn().checkProjectUuidPermission(UserRole.ADMIN, component.projectUuid()); } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/persistence/CustomMeasureDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/persistence/CustomMeasureDaoTest.java index 9eb752b0358..b071bc00d5f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/persistence/CustomMeasureDaoTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/persistence/CustomMeasureDaoTest.java @@ -67,7 +67,6 @@ public class CustomMeasureDaoTest { CustomMeasureDto result = sut.selectNullableById(session, measure.getId()); assertThat(result.getId()).isEqualTo(measure.getId()); assertThat(result.getMetricId()).isEqualTo(measure.getMetricId()); - assertThat(result.getComponentId()).isEqualTo(measure.getComponentId()); assertThat(result.getComponentUuid()).isEqualTo(measure.getComponentUuid()); assertThat(result.getDescription()).isEqualTo(measure.getDescription()); assertThat(result.getUserLogin()).isEqualTo(measure.getUserLogin()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/persistence/CustomMeasureTesting.java b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/persistence/CustomMeasureTesting.java index 4c968575c05..dacee6f26cc 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/persistence/CustomMeasureTesting.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/persistence/CustomMeasureTesting.java @@ -37,7 +37,6 @@ public class CustomMeasureTesting { .setUserLogin(RandomStringUtils.randomAlphanumeric(255)) .setValue(RandomUtils.nextDouble()) .setMetricId(RandomUtils.nextInt()) - .setComponentId(RandomUtils.nextInt()) .setComponentUuid(RandomStringUtils.randomAlphanumeric(50)) .setCreatedAt(System2.INSTANCE.now()) .setUpdatedAt(System2.INSTANCE.now()); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/DeleteActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/DeleteActionTest.java index 649565ae477..b2b3cca8a8a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/DeleteActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/DeleteActionTest.java @@ -93,7 +93,7 @@ public class DeleteActionTest { ComponentDto project = ComponentTesting.newProjectDto("project-uuid"); dbClient.componentDao().insert(dbSession, project); userSessionRule.login("login").addProjectUuidPermissions(UserRole.ADMIN, "project-uuid"); - long id = insertCustomMeasure(newCustomMeasureDto().setComponentId(project.getId())); + long id = insertCustomMeasure(newCustomMeasureDto().setComponentUuid("project-uuid")); newRequest().setParam(PARAM_ID, String.valueOf(id)).execute(); @@ -113,7 +113,7 @@ public class DeleteActionTest { userSessionRule.login("login"); ComponentDto project = ComponentTesting.newProjectDto("any-uuid"); dbClient.componentDao().insert(dbSession, project); - long id = insertCustomMeasure(newCustomMeasureDto().setComponentId(project.getId())); + long id = insertCustomMeasure(newCustomMeasureDto().setComponentUuid("any-uuid")); newRequest().setParam(PARAM_ID, String.valueOf(id)).execute(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java index 800d58e330a..0225dcb5708 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/MetricsActionTest.java @@ -107,7 +107,6 @@ public class MetricsActionTest { CustomMeasureDto customMeasure = newCustomMeasureDto() .setComponentUuid(project.uuid()) - .setComponentId(project.getId()) .setMetricId(metric.getId()); dbClient.customMeasureDao().insert(dbSession, customMeasure); dbSession.commit(); @@ -127,7 +126,6 @@ public class MetricsActionTest { CustomMeasureDto customMeasure = newCustomMeasureDto() .setComponentUuid(project.uuid()) - .setComponentId(project.getId()) .setMetricId(metric.getId()); dbClient.customMeasureDao().insert(dbSession, customMeasure); dbSession.commit(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/UpdateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/UpdateActionTest.java index 57031a6fa0d..a143bd026af 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/UpdateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/UpdateActionTest.java @@ -211,7 +211,6 @@ public class UpdateActionTest { ComponentDto component = insertNewProject("project-uuid"); CustomMeasureDto customMeasure = newCustomMeasure(component, metric) .setMetricId(metric.getId()) - .setComponentId(component.getId()) .setComponentUuid(component.uuid()) .setCreatedAt(system.now()) .setDescription("custom-measure-description") @@ -265,7 +264,6 @@ public class UpdateActionTest { dbClient.componentDao().insert(dbSession, component); CustomMeasureDto customMeasure = newCustomMeasureDto() .setMetricId(metric.getId()) - .setComponentId(component.getId()) .setComponentUuid(component.uuid()) .setCreatedAt(system.now()) .setDescription("custom-measure-description") @@ -290,7 +288,6 @@ public class UpdateActionTest { dbClient.componentDao().insert(dbSession, component); CustomMeasureDto customMeasure = newCustomMeasureDto() .setMetricId(metric.getId()) - .setComponentId(component.getId()) .setComponentUuid(component.uuid()) .setCreatedAt(system.now()) .setDescription("custom-measure-description") @@ -340,7 +337,6 @@ public class UpdateActionTest { private CustomMeasureDto newCustomMeasure(ComponentDto project, MetricDto metric) { return newCustomMeasureDto() .setMetricId(metric.getId()) - .setComponentId(project.getId()) .setComponentUuid(project.uuid()) .setCreatedAt(system.now()); } diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/CustomMeasuresCopyStepTest/custom-measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/CustomMeasuresCopyStepTest/custom-measures.xml index 2b538a24cf5..4d2a1cd4e27 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/CustomMeasuresCopyStepTest/custom-measures.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/CustomMeasuresCopyStepTest/custom-measures.xml @@ -1,7 +1,7 @@ <dataset> <manual_measures id="1" metric_id="10" - resource_id="100" + component_uuid="FILE1" value="3.14" text_value="[null]" @@ -12,7 +12,7 @@ <manual_measures id="2" metric_id="11" - resource_id="101" + component_uuid="PROJECT1" value="[null]" text_value="good" diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_measures_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_measures_controller.rb index dc76a17b497..645e3a148f6 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_measures_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/manual_measures_controller.rb @@ -39,7 +39,7 @@ class ManualMeasuresController < ApplicationController def edit_form @metric=Metric.by_key(params[:metric]) - @measure=ManualMeasure.find(:first, :conditions => ['resource_id=? and metric_id=?', @resource.id, @metric.id]) || ManualMeasure.new + @measure=ManualMeasure.find(:first, :conditions => ['component_uuid=? and metric_id=?', @resource.uuid, @metric.id]) || ManualMeasure.new render :partial => 'manual_measures/edit_form' end @@ -74,7 +74,7 @@ class ManualMeasuresController < ApplicationController def edit verify_post_request @metric=Metric.by_key(params[:metric]) - @measure=ManualMeasure.find(:first, :conditions => ['resource_id=? and metric_id=?', @resource.id, @metric.id]) + @measure=ManualMeasure.find(:first, :conditions => ['component_uuid=? and metric_id=?', @resource.uuid, @metric.id]) @measure.typed_value=params[:val] @measure.description=params[:desc] @@ -93,7 +93,7 @@ class ManualMeasuresController < ApplicationController def delete verify_post_request metric=Metric.by_key(params[:metric]) - ManualMeasure.destroy_all(['resource_id=? and metric_id=?', @resource.id, metric.id]) + ManualMeasure.destroy_all(['component_uuid=? and metric_id=?', @resource.uuid, metric.id]) flash[:notice] = 'Measure successfully deleted.' redirect_to :action => 'index', :id => params[:id] end @@ -101,6 +101,6 @@ class ManualMeasuresController < ApplicationController private def load_measures - @measures=ManualMeasure.find(:all, :conditions => ['resource_id=?', @resource.id]).select { |m| m.metric.enabled } + @measures=ManualMeasure.find(:all, :conditions => ['component_uuid=?', @resource.uuid]).select { |m| m.metric.enabled } end end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/manual_measure.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/manual_measure.rb index 3bc2607c722..9131f0f1e7e 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/manual_measure.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/manual_measure.rb @@ -20,8 +20,8 @@ class ManualMeasure < ActiveRecord::Base include ActionView::Helpers::NumberHelper - belongs_to :resource, :class_name => 'Project' - validates_uniqueness_of :metric_id, :scope => :resource_id + belongs_to :resource, :class_name => 'Project', :foreign_key => 'component_uuid', :primary_key => 'uuid' + validates_uniqueness_of :metric_id, :scope => :component_uuid validates_length_of :text_value, :maximum => 4000, :allow_nil => true, :allow_blank => true validates_length_of :description, :maximum => 4000, :allow_nil => true, :allow_blank => true validate :validate_metric, :validate_value diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb index 2c6c8b9cbf7..ad3fd0379ea 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb @@ -27,7 +27,7 @@ class Project < ActiveRecord::Base has_many :project_links, :foreign_key => 'component_uuid', :primary_key => 'uuid', :dependent => :delete_all, :order => 'link_type' has_many :user_roles, :foreign_key => 'resource_id' has_many :group_roles, :foreign_key => 'resource_id' - has_many :manual_measures, :foreign_key => 'resource_id' + has_many :manual_measures, :foreign_key => 'component_uuid', :primary_key => 'uuid' belongs_to :root, :class_name => 'Project', :foreign_key => 'root_id' belongs_to :copy_resource, :class_name => 'Project', :foreign_key => 'copy_resource_id' belongs_to :person, :class_name => 'Project', :foreign_key => 'person_id' diff --git a/server/sonar-web/src/main/webapp/WEB-INF/config/routes.rb b/server/sonar-web/src/main/webapp/WEB-INF/config/routes.rb index 29a2653ff77..098d8cccf9a 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/config/routes.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/config/routes.rb @@ -4,7 +4,6 @@ ActionController::Routing::Routes.draw do |map| api.resources :user_properties, :only => [:index, :show, :create, :destroy], :requirements => { :id => /.*/ } api.resources :projects, :only => [:index], :requirements => { :id => /.*/ } api.resources :favourites, :only => [:index, :show, :create, :destroy], :requirements => { :id => /.*/ } - api.resources :manual_measures, :only => [:index, :create, :destroy], :requirements => { :id => /.*/ } end map.connect 'api', :controller => 'api/java_ws', :action => 'redirect_to_ws_listing' diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/923_remove_manual_measures_resource_id.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/923_remove_manual_measures_resource_id.rb new file mode 100644 index 00000000000..00d10a2b450 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/923_remove_manual_measures_resource_id.rb @@ -0,0 +1,32 @@ +# +# 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. +# + +# +# SonarQube 5.2 +# SONAR-6634 +# +class RemoveManualMeasuresResourceId < ActiveRecord::Migration + + def self.up + remove_index 'manual_measures', :name => 'manual_measures_resource_id' + remove_column 'manual_measures', 'resource_id' + end + +end diff --git a/sonar-batch/src/test/resources/org/sonar/batch/compute/ManualMeasureDecoratorTest/testCopyManualMeasures.xml b/sonar-batch/src/test/resources/org/sonar/batch/compute/ManualMeasureDecoratorTest/testCopyManualMeasures.xml index a61777d3ad8..02eacbbd46d 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/compute/ManualMeasureDecoratorTest/testCopyManualMeasures.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/compute/ManualMeasureDecoratorTest/testCopyManualMeasures.xml @@ -5,7 +5,7 @@ enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> - <manual_measures id="1" metric_id="2" resource_id="30" component_uuid="ABCD" value="3.14" text_value="pi" created_at="[null]" updated_at="[null]" description="this is pi" user_login="me"/> - <manual_measures id="2" metric_id="2" resource_id="40" component_uuid="EFGH" value="6" text_value="six" created_at="[null]" updated_at="[null]" description="this is six" user_login="me"/> + <manual_measures id="1" metric_id="2" component_uuid="ABCD" value="3.14" text_value="pi" created_at="[null]" updated_at="[null]" description="this is pi" user_login="me"/> + <manual_measures id="2" metric_id="2" component_uuid="EFGH" value="6" text_value="six" created_at="[null]" updated_at="[null]" description="this is six" user_login="me"/> </dataset> diff --git a/sonar-core/src/main/java/org/sonar/core/measure/custom/db/CustomMeasureDto.java b/sonar-core/src/main/java/org/sonar/core/measure/custom/db/CustomMeasureDto.java index 26030e3067e..615e9839161 100644 --- a/sonar-core/src/main/java/org/sonar/core/measure/custom/db/CustomMeasureDto.java +++ b/sonar-core/src/main/java/org/sonar/core/measure/custom/db/CustomMeasureDto.java @@ -23,7 +23,6 @@ package org.sonar.core.measure.custom.db; public class CustomMeasureDto { private long id; private int metricId; - private long componentId; private String componentUuid; private double value; private String textValue; @@ -68,15 +67,6 @@ public class CustomMeasureDto { return this; } - public long getComponentId() { - return componentId; - } - - public CustomMeasureDto setComponentId(long componentId) { - this.componentId = componentId; - return this; - } - public int getMetricId() { return metricId; } 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 8f2dd4a04aa..836c3f7fdc0 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 @@ -34,7 +34,7 @@ import org.sonar.api.server.ServerSide; @ServerSide public class DatabaseVersion { - public static final int LAST_VERSION = 922; + public static final int LAST_VERSION = 923; /** * List of all the tables. diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java index e34957e39f9..14d9d9d69d3 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java @@ -97,8 +97,8 @@ class PurgeCommands { profiler.stop(); profiler.start("deleteResourceManualMeasures (manual_measures)"); - for (List<Long> partResourceIds : componentIdPartitions) { - purgeMapper.deleteResourceManualMeasures(partResourceIds); + for (List<String> componentUuidPartition : componentUuidsPartitions) { + purgeMapper.deleteResourceManualMeasures(componentUuidPartition); } session.commit(); profiler.stop(); diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java index 5850596aaf7..914add27596 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java @@ -67,7 +67,7 @@ public interface PurgeMapper { void deleteResourceUserRoles(@Param("resourceIds") List<Long> resourceIds); - void deleteResourceManualMeasures(@Param("resourceIds") List<Long> resourceIds); + void deleteResourceManualMeasures(@Param("componentUuids") List<String> componentUuids); void deleteComponentEvents(@Param("componentUuids") List<String> componentUuids); diff --git a/sonar-core/src/main/resources/org/sonar/core/measure/custom/db/CustomMeasureMapper.xml b/sonar-core/src/main/resources/org/sonar/core/measure/custom/db/CustomMeasureMapper.xml index f9062d192d6..e19060dbc1a 100644 --- a/sonar-core/src/main/resources/org/sonar/core/measure/custom/db/CustomMeasureMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/measure/custom/db/CustomMeasureMapper.xml @@ -5,7 +5,6 @@ <sql id="selectColumns"> m.id, m.metric_id as metricId, - m.resource_id as componentId, m.component_uuid as componentUuid, m.value, m.text_value as textValue, @@ -38,10 +37,10 @@ <insert id="insert" parameterType="CustomMeasure" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> INSERT INTO manual_measures ( - metric_id, resource_id, component_uuid, value, text_value, user_login, description, created_at, updated_at + metric_id, component_uuid, value, text_value, user_login, description, created_at, updated_at ) VALUES ( - #{metricId, jdbcType=INTEGER}, #{componentId, jdbcType=INTEGER}, #{componentUuid, jdbcType=VARCHAR}, + #{metricId, jdbcType=INTEGER}, #{componentUuid, jdbcType=VARCHAR}, #{value, jdbcType=DOUBLE}, #{textValue, jdbcType=VARCHAR}, #{userLogin, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR}, #{createdAt, jdbcType=BIGINT}, #{updatedAt, jdbcType=BIGINT} ) 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 87fa2131d12..706947ab524 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 @@ -342,6 +342,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('919'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('920'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('921'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('922'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('923'); 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', '1418215735482', '1418215735482', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index 362aa97b831..d0ad5236787 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -263,7 +263,6 @@ CREATE TABLE "PROJECTS" ( CREATE TABLE "MANUAL_MEASURES" ( "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "METRIC_ID" INTEGER NOT NULL, - "RESOURCE_ID" INTEGER, "COMPONENT_UUID" VARCHAR(50), "VALUE" DOUBLE, "TEXT_VALUE" VARCHAR(4000), @@ -600,8 +599,6 @@ CREATE INDEX "WIDGET_PROPERTIES_WIDGETS" ON "WIDGET_PROPERTIES" ("WIDGET_ID"); CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY"); -CREATE INDEX "MANUAL_MEASURES_RESOURCE_ID" ON "MANUAL_MEASURES" ("RESOURCE_ID"); - CREATE INDEX "MANUAL_MEASURES_COMPONENT_UUID" ON "MANUAL_MEASURES" ("COMPONENT_UUID"); CREATE INDEX "PROJECTS_KEE" ON "PROJECTS" ("KEE", "ENABLED"); diff --git a/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml b/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml index ae7a29fc062..de41b816f28 100644 --- a/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml @@ -204,9 +204,9 @@ </delete> <delete id="deleteResourceManualMeasures" parameterType="map"> - delete from manual_measures where resource_id in - <foreach collection="resourceIds" open="(" close=")" item="resourceId" separator=","> - #{resourceId} + delete from manual_measures where component_uuid in + <foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=","> + #{componentUuid} </foreach> </delete> |