aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-12-01 16:12:23 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-12-08 00:26:54 +0100
commit3197dc1e41dfb2d0072d1fbcd9697eb125984434 (patch)
treeac31d017db245137da46d6158dcabd2ec21e7e3d /sonar-db
parenteee89a07d6a0bfeae589a88983df44dc2cc167b6 (diff)
downloadsonarqube-3197dc1e41dfb2d0072d1fbcd9697eb125984434.tar.gz
sonarqube-3197dc1e41dfb2d0072d1fbcd9697eb125984434.zip
SONAR-6900 add snapshot_id column in ce_activity db table
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/java/org/sonar/db/ce/CeActivityDto.java11
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml4
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql1
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl1
-rw-r--r--sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java2
5 files changed, 18 insertions, 1 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/ce/CeActivityDto.java b/sonar-db/src/main/java/org/sonar/db/ce/CeActivityDto.java
index 35133e20db0..db945aa9986 100644
--- a/sonar-db/src/main/java/org/sonar/db/ce/CeActivityDto.java
+++ b/sonar-db/src/main/java/org/sonar/db/ce/CeActivityDto.java
@@ -35,6 +35,7 @@ public class CeActivityDto {
private String uuid;
private String componentUuid;
+ private Long snapshotId;
private Status status;
private String taskType;
private boolean isLast;
@@ -165,6 +166,16 @@ public class CeActivityDto {
this.executionTimeMs = l;
}
+ @CheckForNull
+ public Long getSnapshotId() {
+ return snapshotId;
+ }
+
+ public CeActivityDto setSnapshotId(@Nullable Long snapshotId) {
+ this.snapshotId = snapshotId;
+ return this;
+ }
+
@Override
public String toString() {
return Objects.toStringHelper(this)
diff --git a/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml b/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml
index 155d1da39e2..1050b096954 100644
--- a/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml
+++ b/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml
@@ -7,6 +7,7 @@
ca.uuid,
ca.task_type as taskType,
ca.component_uuid as componentUuid,
+ ca.snapshot_id as snapshotId,
ca.status as status,
ca.submitter_login as submitterLogin,
ca.submitted_at as submittedAt,
@@ -89,11 +90,12 @@
<insert id="insert" parameterType="org.sonar.db.ce.CeActivityDto" useGeneratedKeys="false">
insert into ce_activity
- (uuid, component_uuid, status, task_type, is_last, is_last_key, submitter_login, submitted_at, started_at,
+ (uuid, component_uuid, snapshot_id, status, task_type, is_last, is_last_key, submitter_login, submitted_at, started_at,
executed_at, created_at, updated_at, execution_time_ms)
values (
#{uuid,jdbcType=VARCHAR},
#{componentUuid,jdbcType=VARCHAR},
+ #{snapshotId,jdbcType=INTEGER},
#{status,jdbcType=VARCHAR},
#{taskType,jdbcType=VARCHAR},
#{isLast,jdbcType=BOOLEAN},
diff --git a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql
index 1e3e3a14b43..89350292182 100644
--- a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql
+++ b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql
@@ -364,6 +364,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1000');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1001');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1002');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1003');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1004');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1005');
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);
diff --git a/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl b/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl
index bda06b21a81..036d03b4c69 100644
--- a/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl
+++ b/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl
@@ -540,6 +540,7 @@ CREATE TABLE "CE_ACTIVITY" (
"UUID" VARCHAR(40) NOT NULL,
"TASK_TYPE" VARCHAR(15) NOT NULL,
"COMPONENT_UUID" VARCHAR(40) NULL,
+ "SNAPSHOT_ID" INTEGER NULL,
"STATUS" VARCHAR(15) NOT NULL,
"IS_LAST" BOOLEAN NOT NULL,
"IS_LAST_KEY" VARCHAR(55) NOT NULL,
diff --git a/sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java b/sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java
index 32f6ae890b4..af0b0b81798 100644
--- a/sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java
@@ -61,6 +61,7 @@ public class CeActivityDaoTest {
assertThat(saved.get().getStartedAt()).isEqualTo(1_500_000_000_000L);
assertThat(saved.get().getExecutedAt()).isEqualTo(1_500_000_000_500L);
assertThat(saved.get().getExecutionTimeMs()).isEqualTo(500L);
+ assertThat(saved.get().getSnapshotId()).isEqualTo(123_456);
assertThat(saved.get().toString()).isNotEmpty();
}
@@ -250,6 +251,7 @@ public class CeActivityDaoTest {
dto.setStartedAt(1_500_000_000_000L);
dto.setExecutedAt(1_500_000_000_500L);
dto.setExecutionTimeMs(500L);
+ dto.setSnapshotId(123_456L);
underTest.insert(db.getSession(), dto);
}