summaryrefslogtreecommitdiffstats
path: root/sonar-core/src
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-02-11 15:05:15 +0100
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2015-02-17 17:34:37 +0100
commit1f5a84ff501e6404a7a2a89c166dde0ba46bceb2 (patch)
tree0760aa2bc95cfeee8f16aa1ae1ef8e4ac0928678 /sonar-core/src
parent1af0c2e7482eaa4912a1c9aef1f98cfb1c3c10f4 (diff)
downloadsonarqube-1f5a84ff501e6404a7a2a89c166dde0ba46bceb2.tar.gz
sonarqube-1f5a84ff501e6404a7a2a89c166dde0ba46bceb2.zip
SONAR-6163 - timezones - events migration
Diffstat (limited to 'sonar-core/src')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java2
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql3
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl4
-rw-r--r--sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java6
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml2
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml2
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml4
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml8
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml8
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml2
10 files changed, 21 insertions, 20 deletions
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 048e602afe9..790209ba8b0 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
@@ -33,7 +33,7 @@ import java.util.List;
*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 790;
+ public static final int LAST_VERSION = 793;
/**
* List of all the tables.n
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 af6b0b2df00..c44b9b31dd4 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
@@ -317,6 +317,9 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('787');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('788');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('789');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('790');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('791');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('792');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('793');
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 484d9265b83..86d2134ef54 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
@@ -167,8 +167,8 @@ CREATE TABLE "EVENTS" (
"RESOURCE_ID" INTEGER,
"SNAPSHOT_ID" INTEGER,
"CATEGORY" VARCHAR(50),
- "EVENT_DATE" TIMESTAMP,
- "CREATED_AT" TIMESTAMP,
+ "EVENT_DATE" BIGINT NOT NULL,
+ "CREATED_AT" BIGINT NOT NULL,
"DESCRIPTION" VARCHAR(4000),
"EVENT_DATA" VARCHAR(4000)
);
diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java
index d7d285e42fa..693ea65a447 100644
--- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java
@@ -115,12 +115,10 @@ public class PurgeCommandsTest extends AbstractDaoTestCase {
@Test
public void shouldDeleteResource() {
setupData("shouldDeleteResource");
- SqlSession session = getMyBatis().openSession();
- try {
+ try (SqlSession session = getMyBatis().openSession()) {
new PurgeCommands(session, profiler).deleteResources(newArrayList(new IdUuidPair(1L, "1")));
- } finally {
- MyBatis.closeQuietly(session);
}
+
assertEmptyTables("projects", "snapshots", "events", "issues", "issue_changes", "authors");
}
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml
index e7d8f49a2b4..2f30df757d0 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml
@@ -16,7 +16,7 @@
version="[null]" path="[null]"/>
<events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]"
- event_date="2008-12-02 13:58:00.00" created_at="[null]" event_data="[null]"/>
+ event_date="1228222680000" created_at="1228222680000" event_data="[null]"/>
<issues id="1" kee="ABCDE" component_uuid="1" project_uuid="1" status="CLOSED" resolution="[null]" line="200"
severity="BLOCKER"
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
index 3bac29d413a..f7a0a3a81b3 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
@@ -26,7 +26,7 @@
parent_dependency_id="[null]" project_snapshot_id="1"
dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
<events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]"
- event_date="2008-12-02 13:58:00.00" created_at="[null]" event_data="[null]"/>
+ event_date="1228222680000" created_at="1228222680000" event_data="[null]"/>
<duplications_index id="1" project_snapshot_id="1" snapshot_id="1" hash="bb" index_in_file="0" start_line="0"
end_line="0"/>
</dataset>
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
index 8fd273d1c08..45eaee58163 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
@@ -25,7 +25,7 @@
parent_dependency_id="[null]" project_snapshot_id="1"
dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
<events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]"
- event_date="2008-12-02 13:58:00.00" created_at="[null]" event_data="[null]"/>
+ event_date="1228222680000" created_at="1228222680000" event_data="[null]"/>
<duplications_index id="1" project_snapshot_id="1" snapshot_id="1" hash="bb" index_in_file="0" start_line="0"
end_line="0"/>
@@ -58,7 +58,7 @@
parent_dependency_id="[null]" project_snapshot_id="5"
dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
<events id="2" name="Version 1.0" resource_id="5" snapshot_id="5" category="VERSION" description="[null]"
- event_date="2008-12-02 13:58:00.00" created_at="[null]" event_data="[null]"/>
+ event_date="1228222680000" created_at="1228222680000" event_data="[null]"/>
<duplications_index id="2" project_snapshot_id="5" snapshot_id="5" hash="bb" index_in_file="0" start_line="0"
end_line="0"/>
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
index bcd5544b9f6..4a45a7fc405 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
@@ -42,8 +42,8 @@ Note that measures, events and reviews are not deleted.
<!--dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>-->
<events id="1" resource_id="1" snapshot_id="1"
- category="VERSION" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00"
- created_at="[null]"
+ category="VERSION" description="[null]" name="Version 1.0" event_date="1228222680000"
+ created_at="1228222680000"
event_data="[null]"/>
<!--<duplications_index id="1" project_snapshot_id="1" snapshot_id="1"-->
@@ -81,8 +81,8 @@ Note that measures, events and reviews are not deleted.
dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>
<events id="2" resource_id="2" snapshot_id="2"
- category="VERSION" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00"
- created_at="[null]"
+ category="VERSION" description="[null]" name="Version 1.0" event_date="1228222680000"
+ created_at="1228222680000"
event_data="[null]"/>
<duplications_index id="2" project_snapshot_id="2" snapshot_id="2"
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
index 5a576b3edf8..6c6e5bd44c2 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
@@ -27,8 +27,8 @@
dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>
<events id="1" resource_id="1" snapshot_id="1"
- category="VERSION" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00"
- created_at="[null]"
+ category="VERSION" description="[null]" name="Version 1.0" event_date="1228222680000"
+ created_at="1228222680000"
event_data="[null]"/>
<duplications_index id="1" project_snapshot_id="1" snapshot_id="1"
@@ -65,8 +65,8 @@
dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>
<events id="2" resource_id="2" snapshot_id="2"
- category="VERSION" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00"
- created_at="[null]"
+ category="VERSION" description="[null]" name="Version 1.0" event_date="1228222680000"
+ created_at="1228222680000"
event_data="[null]"/>
<duplications_index id="2" project_snapshot_id="2" snapshot_id="2"
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml
index f3a3b9bd0b3..78e14ead2a7 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml
@@ -56,7 +56,7 @@
depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" version="[null]" path="[null]"/>
<events id="2" resource_id="1" snapshot_id="5"
- category="Version" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00" created_at="[null]"
+ category="Version" description="[null]" name="Version 1.0" event_date="1228222680000" created_at="1228222680000"
event_data="[null]"/>
</dataset>