@@ -66,10 +66,12 @@ import org.sonar.server.db.migrations.v51.RenameComponentRelatedParamsInIssueFil | |||
import org.sonar.server.db.migrations.v51.UpdateProjectsModuleUuidPath; | |||
import org.sonar.server.db.migrations.v52.AddDependenciesColumns; | |||
import org.sonar.server.db.migrations.v52.AddDependenciesComponentUuidColumns; | |||
import org.sonar.server.db.migrations.v52.AddManualMeasuresComponentUuidColumn; | |||
import org.sonar.server.db.migrations.v52.DropDependenciesComponentColumns; | |||
import org.sonar.server.db.migrations.v52.FeedDependenciesComponentUuids; | |||
import org.sonar.server.db.migrations.v52.FeedEventsComponentUuid; | |||
import org.sonar.server.db.migrations.v52.FeedFileSourcesDataType; | |||
import org.sonar.server.db.migrations.v52.FeedManualMeasuresComponentUuid; | |||
import org.sonar.server.db.migrations.v52.FeedMetricsBooleans; | |||
import org.sonar.server.db.migrations.v52.FeedProjectLinksComponentUuid; | |||
import org.sonar.server.db.migrations.v52.MoveProjectProfileAssociation; | |||
@@ -146,6 +148,8 @@ public class MigrationStepModule extends Module { | |||
DropDependenciesComponentColumns.class, | |||
FeedFileSourcesDataType.class, | |||
FeedMetricsBooleans.class, | |||
AddManualMeasuresComponentUuidColumn.class, | |||
FeedManualMeasuresComponentUuid.class, | |||
AddDependenciesColumns.class); | |||
} | |||
} |
@@ -0,0 +1,58 @@ | |||
/* | |||
* 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.server.db.migrations.v52; | |||
import java.sql.SQLException; | |||
import org.sonar.core.persistence.Database; | |||
import org.sonar.server.db.migrations.AddColumnsBuilder; | |||
import org.sonar.server.db.migrations.DdlChange; | |||
import static org.sonar.server.db.migrations.AddColumnsBuilder.ColumnDef.Type.STRING; | |||
/** | |||
* Add the following column to the manual_measures table : | |||
* - component_uuid | |||
*/ | |||
public class AddManualMeasuresComponentUuidColumn extends DdlChange { | |||
private final Database db; | |||
public AddManualMeasuresComponentUuidColumn(Database db) { | |||
super(db); | |||
this.db = db; | |||
} | |||
@Override | |||
public void execute(DdlChange.Context context) throws SQLException { | |||
context.execute(generateSql()); | |||
} | |||
private String generateSql() { | |||
return new AddColumnsBuilder(db.getDialect(), "manual_measures") | |||
.addColumn( | |||
new AddColumnsBuilder.ColumnDef() | |||
.setName("component_uuid") | |||
.setType(STRING) | |||
.setLimit(50) | |||
.setNullable(true) | |||
) | |||
.build(); | |||
} | |||
} |
@@ -0,0 +1,56 @@ | |||
/* | |||
* 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.server.db.migrations.v52; | |||
import java.sql.SQLException; | |||
import org.sonar.core.persistence.Database; | |||
import org.sonar.server.db.migrations.BaseDataChange; | |||
import org.sonar.server.db.migrations.MassUpdate; | |||
import org.sonar.server.db.migrations.Select; | |||
import org.sonar.server.db.migrations.SqlStatement; | |||
public class FeedManualMeasuresComponentUuid extends BaseDataChange { | |||
public FeedManualMeasuresComponentUuid(Database db) { | |||
super(db); | |||
} | |||
@Override | |||
public void execute(Context context) throws SQLException { | |||
MassUpdate update = context.prepareMassUpdate().rowPluralName("manual measures"); | |||
update.select( | |||
"SELECT p.uuid, mm.resource_id " + | |||
"FROM manual_measures mm " + | |||
"INNER JOIN projects p ON mm.resource_id = p.id " + | |||
"WHERE mm.component_uuid IS NULL"); | |||
update.update("UPDATE manual_measures SET component_uuid=? WHERE resource_id=?"); | |||
update.execute(new MassUpdate.Handler() { | |||
@Override | |||
public boolean handle(Select.Row row, SqlStatement update) throws SQLException { | |||
update.setString(1, row.getString(1)); | |||
update.setLong(2, row.getLong(2)); | |||
return true; | |||
} | |||
}); | |||
} | |||
} |
@@ -25,8 +25,8 @@ import java.util.List; | |||
import javax.annotation.CheckForNull; | |||
import javax.annotation.Nonnull; | |||
import org.sonar.api.server.ServerSide; | |||
import org.sonar.core.custommeasure.db.CustomMeasureDto; | |||
import org.sonar.core.custommeasure.db.CustomMeasureMapper; | |||
import org.sonar.core.measure.custom.db.CustomMeasureDto; | |||
import org.sonar.core.measure.custom.db.CustomMeasureMapper; | |||
import org.sonar.core.persistence.DaoComponent; | |||
import org.sonar.core.persistence.DaoUtils; | |||
import org.sonar.core.persistence.DbSession; |
@@ -25,7 +25,7 @@ import org.sonar.api.server.ws.Response; | |||
import org.sonar.api.server.ws.WebService; | |||
import org.sonar.api.web.UserRole; | |||
import org.sonar.core.component.ComponentDto; | |||
import org.sonar.core.custommeasure.db.CustomMeasureDto; | |||
import org.sonar.core.measure.custom.db.CustomMeasureDto; | |||
import org.sonar.core.permission.GlobalPermissions; | |||
import org.sonar.core.persistence.DbSession; | |||
import org.sonar.core.persistence.MyBatis; |
@@ -28,7 +28,7 @@ import org.sonar.api.server.ws.Request; | |||
import org.sonar.api.server.ws.Response; | |||
import org.sonar.api.server.ws.WebService; | |||
import org.sonar.api.utils.text.JsonWriter; | |||
import org.sonar.core.custommeasure.db.CustomMeasureDto; | |||
import org.sonar.core.measure.custom.db.CustomMeasureDto; | |||
import org.sonar.core.metric.db.MetricDto; | |||
import org.sonar.core.permission.GlobalPermissions; | |||
import org.sonar.core.persistence.DbSession; |
@@ -28,7 +28,7 @@ import org.sonar.api.server.ws.Request; | |||
import org.sonar.api.server.ws.Response; | |||
import org.sonar.api.server.ws.WebService; | |||
import org.sonar.api.utils.text.JsonWriter; | |||
import org.sonar.core.custommeasure.db.CustomMeasureDto; | |||
import org.sonar.core.measure.custom.db.CustomMeasureDto; | |||
import org.sonar.core.metric.db.MetricDto; | |||
import org.sonar.core.permission.GlobalPermissions; | |||
import org.sonar.core.persistence.DbSession; |
@@ -29,6 +29,6 @@ public class MigrationStepModuleTest { | |||
public void verify_count_of_added_MigrationStep_types() throws Exception { | |||
ComponentContainer container = new ComponentContainer(); | |||
new MigrationStepModule().configure(container); | |||
assertThat(container.size()).isEqualTo(55); | |||
assertThat(container.size()).isEqualTo(57); | |||
} | |||
} |
@@ -0,0 +1,48 @@ | |||
/* | |||
* 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.server.db.migrations.v52; | |||
import java.sql.Types; | |||
import org.junit.Before; | |||
import org.junit.ClassRule; | |||
import org.junit.Test; | |||
import org.sonar.core.persistence.DbTester; | |||
public class AddManualMeasuresComponentUuidColumnTest { | |||
@ClassRule | |||
public static DbTester db = new DbTester().schema(AddManualMeasuresComponentUuidColumnTest.class, "schema.sql"); | |||
AddManualMeasuresComponentUuidColumn sut; | |||
@Before | |||
public void setUp() { | |||
sut = new AddManualMeasuresComponentUuidColumn(db.database()); | |||
} | |||
@Test | |||
public void update_columns() throws Exception { | |||
sut.execute(); | |||
db.assertColumnDefinition("manual_measures", "component_uuid", Types.VARCHAR, 50); | |||
} | |||
} |
@@ -0,0 +1,54 @@ | |||
/* | |||
* 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.server.db.migrations.v52; | |||
import org.junit.Before; | |||
import org.junit.ClassRule; | |||
import org.junit.Test; | |||
import org.sonar.core.persistence.DbTester; | |||
public class FeedManualMeasuresComponentUuidTest { | |||
@ClassRule | |||
public static DbTester db = new DbTester().schema(FeedManualMeasuresComponentUuidTest.class, "schema.sql"); | |||
FeedManualMeasuresComponentUuid sut; | |||
@Before | |||
public void setUp() { | |||
db.executeUpdateSql("truncate table manual_measures"); | |||
db.executeUpdateSql("truncate table projects"); | |||
sut = new FeedManualMeasuresComponentUuid(db.database()); | |||
} | |||
@Test | |||
public void migrate_empty_db() throws Exception { | |||
sut.execute(); | |||
} | |||
@Test | |||
public void migrate() throws Exception { | |||
db.prepareDbUnit(this.getClass(), "migrate.xml"); | |||
sut.execute(); | |||
db.assertDbUnit(this.getClass(), "migrate-result.xml", "manual_measures"); | |||
} | |||
} |
@@ -27,7 +27,7 @@ import org.junit.Before; | |||
import org.junit.ClassRule; | |||
import org.junit.Test; | |||
import org.junit.experimental.categories.Category; | |||
import org.sonar.core.custommeasure.db.CustomMeasureDto; | |||
import org.sonar.core.measure.custom.db.CustomMeasureDto; | |||
import org.sonar.core.persistence.DbSession; | |||
import org.sonar.core.persistence.DbTester; | |||
import org.sonar.server.db.DbClient; | |||
@@ -68,6 +68,7 @@ public class CustomMeasureDaoTest { | |||
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()); | |||
assertThat(result.getTextValue()).isEqualTo(measure.getTextValue()); |
@@ -23,7 +23,7 @@ package org.sonar.server.measure.custom.persistence; | |||
import org.apache.commons.lang.RandomStringUtils; | |||
import org.apache.commons.lang.math.RandomUtils; | |||
import org.sonar.api.utils.System2; | |||
import org.sonar.core.custommeasure.db.CustomMeasureDto; | |||
import org.sonar.core.measure.custom.db.CustomMeasureDto; | |||
public class CustomMeasureTesting { | |||
private CustomMeasureTesting() { | |||
@@ -38,8 +38,8 @@ public class CustomMeasureTesting { | |||
.setValue(RandomUtils.nextDouble()) | |||
.setMetricId(RandomUtils.nextInt()) | |||
.setComponentId(RandomUtils.nextInt()) | |||
.setComponentUuid(RandomStringUtils.random(50)) | |||
.setCreatedAt(System2.INSTANCE.now()) | |||
.setUpdatedAt(System2.INSTANCE.now()) | |||
; | |||
.setUpdatedAt(System2.INSTANCE.now()); | |||
} | |||
} |
@@ -28,7 +28,7 @@ import org.junit.Test; | |||
import org.junit.rules.ExpectedException; | |||
import org.sonar.api.web.UserRole; | |||
import org.sonar.core.component.ComponentDto; | |||
import org.sonar.core.custommeasure.db.CustomMeasureDto; | |||
import org.sonar.core.measure.custom.db.CustomMeasureDto; | |||
import org.sonar.core.permission.GlobalPermissions; | |||
import org.sonar.core.persistence.DbSession; | |||
import org.sonar.core.persistence.DbTester; |
@@ -29,7 +29,7 @@ import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.experimental.categories.Category; | |||
import org.junit.rules.ExpectedException; | |||
import org.sonar.core.custommeasure.db.CustomMeasureDto; | |||
import org.sonar.core.measure.custom.db.CustomMeasureDto; | |||
import org.sonar.core.metric.db.MetricDto; | |||
import org.sonar.core.permission.GlobalPermissions; | |||
import org.sonar.core.persistence.DbSession; |
@@ -0,0 +1,11 @@ | |||
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, | |||
"VALUE" DOUBLE, | |||
"TEXT_VALUE" VARCHAR(4000), | |||
"USER_LOGIN" VARCHAR(255), | |||
"DESCRIPTION" VARCHAR(4000), | |||
"CREATED_AT" BIGINT, | |||
"UPDATED_AT" BIGINT | |||
); |
@@ -0,0 +1,6 @@ | |||
<dataset> | |||
<manual_measures id="1" resource_id="10" component_uuid="ABCD"/> | |||
<manual_measures id="2" resource_id="20" component_uuid="EFGH"/> | |||
</dataset> |
@@ -0,0 +1,9 @@ | |||
<dataset> | |||
<projects id="10" uuid="ABCD"/> | |||
<projects id="20" uuid="EFGH"/> | |||
<manual_measures id="1" resource_id="10" component_uuid="[null]"/> | |||
<manual_measures id="2" resource_id="20" component_uuid="EFGH"/> | |||
</dataset> |
@@ -0,0 +1,10 @@ | |||
CREATE TABLE "MANUAL_MEASURES" ( | |||
"ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), | |||
"RESOURCE_ID" INTEGER, | |||
"COMPONENT_UUID" VARCHAR(50), | |||
); | |||
CREATE TABLE "PROJECTS" ( | |||
"ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), | |||
"UUID" VARCHAR(50), | |||
); |
@@ -168,6 +168,7 @@ class ManualMeasure < ActiveRecord::Base | |||
end | |||
def before_create | |||
self.component_uuid=@resource.uuid | |||
self.created_at=DateTime.now | |||
end | |||
end |
@@ -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-6615 | |||
# | |||
class AddManualMeasuresComponentUuid < ActiveRecord::Migration | |||
def self.up | |||
execute_java_migration('org.sonar.server.db.migrations.v52.AddManualMeasuresComponentUuidColumn') | |||
add_index 'manual_measures', 'component_uuid', :name => 'manual_measures_component_uuid' | |||
end | |||
end |
@@ -0,0 +1,31 @@ | |||
# | |||
# 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-6615 | |||
# | |||
class FeedManualMeasuresComponentUuid < ActiveRecord::Migration | |||
def self.up | |||
execute_java_migration('org.sonar.server.db.migrations.v52.FeedManualMeasuresComponentUuid') | |||
end | |||
end |
@@ -0,0 +1,11 @@ | |||
<dataset> | |||
<metrics delete_historical_data="[null]" id="1" NAME="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" | |||
enabled="true" worst_value="[null]" optimized_best_value="[null]" best_value="[null]" direction="0" hidden="false"/> | |||
<metrics delete_historical_data="[null]" id="2" NAME="review_note" VAL_TYPE="INT" DESCRIPTION="[null]" domain="[null]" short_name="" | |||
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"/> | |||
</dataset> |
@@ -18,12 +18,13 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.core.custommeasure.db; | |||
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; | |||
private String userLogin; | |||
@@ -111,4 +112,13 @@ public class CustomMeasureDto { | |||
this.createdAt = createdAt; | |||
return this; | |||
} | |||
public String getComponentUuid() { | |||
return componentUuid; | |||
} | |||
public CustomMeasureDto setComponentUuid(String componentUuid) { | |||
this.componentUuid = componentUuid; | |||
return this; | |||
} | |||
} |
@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.core.custommeasure.db; | |||
package org.sonar.core.measure.custom.db; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; |
@@ -19,7 +19,7 @@ | |||
*/ | |||
@ParametersAreNonnullByDefault | |||
package org.sonar.core.custommeasure.db; | |||
package org.sonar.core.measure.custom.db; | |||
import javax.annotation.ParametersAreNonnullByDefault; | |||
@@ -34,7 +34,7 @@ import org.sonar.api.server.ServerSide; | |||
@ServerSide | |||
public class DatabaseVersion { | |||
public static final int LAST_VERSION = 917; | |||
public static final int LAST_VERSION = 919; | |||
/** | |||
* List of all the tables.n |
@@ -53,8 +53,8 @@ import org.sonar.core.component.db.SnapshotMapper; | |||
import org.sonar.core.computation.db.AnalysisReportDto; | |||
import org.sonar.core.computation.db.AnalysisReportMapper; | |||
import org.sonar.core.config.Logback; | |||
import org.sonar.core.custommeasure.db.CustomMeasureDto; | |||
import org.sonar.core.custommeasure.db.CustomMeasureMapper; | |||
import org.sonar.core.measure.custom.db.CustomMeasureDto; | |||
import org.sonar.core.measure.custom.db.CustomMeasureMapper; | |||
import org.sonar.core.dashboard.ActiveDashboardDto; | |||
import org.sonar.core.dashboard.ActiveDashboardMapper; | |||
import org.sonar.core.dashboard.DashboardDto; |
@@ -1,11 +1,12 @@ | |||
<?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.core.custommeasure.db.CustomMeasureMapper"> | |||
<mapper namespace="org.sonar.core.measure.custom.db.CustomMeasureMapper"> | |||
<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, | |||
m.user_login as userLogin, | |||
@@ -37,12 +38,12 @@ | |||
<insert id="insert" parameterType="CustomMeasure" useGeneratedKeys="true" keyColumn="id" keyProperty="id"> | |||
INSERT INTO manual_measures ( | |||
metric_id, resource_id, value, text_value, user_login, description, created_at, updated_at | |||
metric_id, resource_id, component_uuid, value, text_value, user_login, description, created_at, updated_at | |||
) | |||
VALUES ( | |||
#{metricId, jdbcType=INTEGER}, #{componentId, jdbcType=INTEGER}, #{value, jdbcType=DOUBLE}, | |||
#{textValue, jdbcType=VARCHAR}, #{userLogin, jdbcType=VARCHAR},#{description, jdbcType=VARCHAR}, | |||
#{createdAt, jdbcType=BIGINT}, #{updatedAt, jdbcType=BIGINT} | |||
#{metricId, jdbcType=INTEGER}, #{componentId, jdbcType=INTEGER}, #{componentUuid, jdbcType=VARCHAR}, | |||
#{value, jdbcType=DOUBLE}, #{textValue, jdbcType=VARCHAR}, #{userLogin, jdbcType=VARCHAR}, | |||
#{description, jdbcType=VARCHAR}, #{createdAt, jdbcType=BIGINT}, #{updatedAt, jdbcType=BIGINT} | |||
) | |||
</insert> | |||
@@ -341,6 +341,8 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('914'); | |||
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('915'); | |||
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('916'); | |||
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('917'); | |||
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('918'); | |||
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('919'); | |||
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; |
@@ -282,6 +282,7 @@ 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), | |||
"USER_LOGIN" VARCHAR(255), | |||
@@ -625,6 +626,8 @@ 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"); | |||
CREATE INDEX "PROJECTS_ROOT_ID" ON "PROJECTS" ("ROOT_ID"); |