]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5868 Fix migration test
authorJulien HENRY <julien.henry@sonarsource.com>
Tue, 25 Nov 2014 08:50:11 +0000 (09:50 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Tue, 25 Nov 2014 08:51:16 +0000 (09:51 +0100)
12 files changed:
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest.java [deleted file]
server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesTest.java [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/after-with-scm.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/after.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/before-with-scm.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/before.xml [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/schema.sql [deleted file]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/after-with-scm.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/after.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/before-with-scm.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/before.xml [new file with mode: 0644]
server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/schema.sql [new file with mode: 0644]

diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest.java
deleted file mode 100644 (file)
index 82e9c3f..0000000
+++ /dev/null
@@ -1,126 +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.server.db.migrations.v50;
-
-import org.apache.commons.dbutils.DbUtils;
-import org.apache.commons.io.Charsets;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.api.utils.DateUtils;
-import org.sonar.api.utils.System2;
-import org.sonar.core.persistence.TestDatabase;
-import org.sonar.server.db.migrations.DatabaseMigration;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.util.Date;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class FeedFileSourcesMigrationTest {
-
-  @ClassRule
-  public static TestDatabase db = new TestDatabase().schema(FeedFileSourcesMigrationTest.class, "schema.sql");
-
-  DatabaseMigration migration;
-
-  System2 system;
-
-  @Before
-  public void setUp() throws Exception {
-    db.executeUpdateSql("truncate table metrics");
-    db.executeUpdateSql("truncate table snapshots");
-    db.executeUpdateSql("truncate table snapshot_sources");
-    db.executeUpdateSql("truncate table projects");
-    db.executeUpdateSql("truncate table project_measures");
-    db.executeUpdateSql("truncate table file_sources");
-
-    system = mock(System2.class);
-    Date now = DateUtils.parseDateTime("2014-11-17T16:27:00+0100");
-    when(system.now()).thenReturn(now.getTime());
-    migration = new FeedFileSources(db.database(), system);
-  }
-
-  @Test
-  public void migrate_empty_db() throws Exception {
-    migration.execute();
-  }
-
-  @Test
-  public void migrate_sources_with_no_scm() throws Exception {
-    db.prepareDbUnit(getClass(), "before.xml");
-
-    db.executeUpdateSql("insert into snapshot_sources " +
-      "(snapshot_id, data, updated_at) " +
-      "values " +
-      "(6, 'class Foo {\r\n  // Empty\r\n}\r\n', '2014-10-31 16:44:02.000')");
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "after.xml", "file_sources");
-  }
-
-  @Test
-  public void migrate_sources_with_scm() throws Exception {
-    db.prepareDbUnit(getClass(), "before.xml");
-
-    Connection connection = null;
-    try {
-      connection = db.openConnection();
-
-      connection.prepareStatement("insert into snapshot_sources " +
-        "(snapshot_id, data, updated_at) " +
-        "values " +
-        "(6, 'class Foo {\r\n  // Empty\r\n}\r\n', '2014-10-31 16:44:02.000')")
-        .executeUpdate();
-
-      PreparedStatement revisionStmt = connection.prepareStatement("insert into project_measures " +
-        "(metric_id, snapshot_id, text_value) " +
-        "values " +
-        "(1, 6, ?)");
-      revisionStmt.setBytes(1, "1=aef12a;2=abe465;3=afb789;4=afb789".getBytes(Charsets.UTF_8));
-      revisionStmt.executeUpdate();
-
-      PreparedStatement authorStmt = connection.prepareStatement("insert into project_measures " +
-        "(metric_id, snapshot_id, text_value) " +
-        "values " +
-        "(2, 6, ?)");
-      authorStmt.setBytes(1, "1=alice;2=bob;3=carol;4=carol".getBytes(Charsets.UTF_8));
-      authorStmt.executeUpdate();
-
-      PreparedStatement dateStmt = connection.prepareStatement("insert into project_measures " +
-        "(metric_id, snapshot_id, text_value) " +
-        "values " +
-        "(3, 6, ?)");
-      dateStmt.setBytes(1, "1=2014-04-25T12:34:56+0100;2=2014-07-25T12:34:56+0100;3=2014-03-23T12:34:56+0100;4=2014-03-23T12:34:56+0100".getBytes(Charsets.UTF_8));
-      dateStmt.executeUpdate();
-    } finally {
-      DbUtils.commitAndCloseQuietly(connection);
-    }
-
-
-    migration.execute();
-
-    db.assertDbUnit(getClass(), "after-with-scm.xml", "file_sources");
-  }
-}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesTest.java b/server/sonar-server/src/test/java/org/sonar/server/db/migrations/v50/FeedFileSourcesTest.java
new file mode 100644 (file)
index 0000000..f9f0e6a
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * 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.v50;
+
+import org.apache.commons.dbutils.DbUtils;
+import org.apache.commons.io.Charsets;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.api.utils.DateUtils;
+import org.sonar.api.utils.System2;
+import org.sonar.core.persistence.TestDatabase;
+import org.sonar.server.db.migrations.DatabaseMigration;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.util.Date;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class FeedFileSourcesTest {
+
+  @ClassRule
+  public static TestDatabase db = new TestDatabase().schema(FeedFileSourcesTest.class, "schema.sql");
+
+  DatabaseMigration migration;
+
+  System2 system;
+
+  @Before
+  public void setUp() throws Exception {
+    db.executeUpdateSql("truncate table metrics");
+    db.executeUpdateSql("truncate table snapshots");
+    db.executeUpdateSql("truncate table snapshot_sources");
+    db.executeUpdateSql("truncate table projects");
+    db.executeUpdateSql("truncate table project_measures");
+    db.executeUpdateSql("truncate table file_sources");
+
+    system = mock(System2.class);
+    Date now = DateUtils.parseDateTime("2014-11-17T16:27:00+0100");
+    when(system.now()).thenReturn(now.getTime());
+    migration = new FeedFileSources(db.database(), system);
+  }
+
+  @Test
+  public void migrate_empty_db() throws Exception {
+    migration.execute();
+  }
+
+  @Test
+  public void migrate_sources_with_no_scm() throws Exception {
+    db.prepareDbUnit(getClass(), "before.xml");
+
+    db.executeUpdateSql("insert into snapshot_sources " +
+      "(snapshot_id, data, updated_at) " +
+      "values " +
+      "(6, 'class Foo {\r\n  // Empty\r\n}\r\n', '2014-10-31 16:44:02.000')");
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "after.xml", "file_sources");
+  }
+
+  @Test
+  public void migrate_sources_with_scm() throws Exception {
+    db.prepareDbUnit(getClass(), "before.xml");
+
+    Connection connection = null;
+    try {
+      connection = db.openConnection();
+
+      connection.prepareStatement("insert into snapshot_sources " +
+        "(snapshot_id, data, updated_at) " +
+        "values " +
+        "(6, 'class Foo {\r\n  // Empty\r\n}\r\n', '2014-10-31 16:44:02.000')")
+        .executeUpdate();
+
+      PreparedStatement revisionStmt = connection.prepareStatement("insert into project_measures " +
+        "(metric_id, snapshot_id, text_value) " +
+        "values " +
+        "(1, 6, ?)");
+      revisionStmt.setBytes(1, "1=aef12a;2=abe465;3=afb789;4=afb789".getBytes(Charsets.UTF_8));
+      revisionStmt.executeUpdate();
+
+      PreparedStatement authorStmt = connection.prepareStatement("insert into project_measures " +
+        "(metric_id, snapshot_id, text_value) " +
+        "values " +
+        "(2, 6, ?)");
+      authorStmt.setBytes(1, "1=alice;2=bob;3=carol;4=carol".getBytes(Charsets.UTF_8));
+      authorStmt.executeUpdate();
+
+      PreparedStatement dateStmt = connection.prepareStatement("insert into project_measures " +
+        "(metric_id, snapshot_id, text_value) " +
+        "values " +
+        "(3, 6, ?)");
+      dateStmt.setBytes(1, "1=2014-04-25T12:34:56+0100;2=2014-07-25T12:34:56+0100;3=2014-03-23T12:34:56+0100;4=2014-03-23T12:34:56+0100".getBytes(Charsets.UTF_8));
+      dateStmt.executeUpdate();
+    } finally {
+      DbUtils.commitAndCloseQuietly(connection);
+    }
+
+
+    migration.execute();
+
+    db.assertDbUnit(getClass(), "after-with-scm.xml", "file_sources");
+  }
+}
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/after-with-scm.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/after-with-scm.xml
deleted file mode 100644 (file)
index c3948bd..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<dataset>
-
-  <file_sources id="1" project_uuid="uuid-MyProject" file_uuid="uuid-MyFile.xoo" created_at="1416238020000" updated_at="1414770242000"
-    data="aef12a,alice,2014-04-25T12:34:56+0100,,class Foo {&#13;&#10;abe465,bob,2014-07-25T12:34:56+0100,,  // Empty&#13;&#10;afb789,carol,2014-03-23T12:34:56+0100,,}&#13;&#10;afb789,carol,2014-03-23T12:34:56+0100,,&#13;&#10;" data_hash="" />
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/after.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/after.xml
deleted file mode 100644 (file)
index b5de4a9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<dataset>
-
-  <file_sources id="1" project_uuid="uuid-MyProject" file_uuid="uuid-MyFile.xoo" created_at="1416238020000" updated_at="1414770242000"
-    data=",,,,class Foo {&#13;&#10;,,,,  // Empty&#13;&#10;,,,,}&#13;&#10;,,,,&#13;&#10;" data_hash="" />
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/before-with-scm.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/before-with-scm.xml
deleted file mode 100644 (file)
index a32c8de..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-<dataset>
-
-  <metrics id="1" name="revisions_by_line" description="[null]" direction="0" domain="SCM" short_name="Revisions by line" qualitative="false" val_type="DATA"
-    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
-  <metrics id="2" name="authors_by_line" description="[null]" direction="0" domain="SCM" short_name="Authors by line" qualitative="false" val_type="DATA"
-    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
-  <metrics id="3" name="last_commit_datetimes_by_line" description="[null]" direction="0" domain="SCM" short_name="Last commit dates by line" qualitative="false" val_type="DATA"
-    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
-
-  <projects id="1" uuid="uuid-MyProject" kee="MyProject" scope="PRJ" qualifier="TRK" />
-  <projects id="2" uuid="uuid-prj" kee="MyProject:src/main/xoo/prj" scope="DIR" qualifier="DIR" />
-  <projects id="3" uuid="uuid-MyFile.xoo" kee="MyProject:src/main/xoo/prj/MyFile.xoo" scope="FIL" qualifier="FIL" />
-
-  <snapshots id="1" project_id="1" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
-          status="P" islast="[false]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-  <snapshots id="2" project_id="1" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
-          status="P" islast="[true]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-
-  <snapshots id="3" project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
-          status="P" islast="[false]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-  <snapshots id="4" project_id="2" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="2"
-          status="P" islast="[true]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-
-  <snapshots id="5" project_id="3" parent_snapshot_id="3" root_project_id="1" root_snapshot_id="1"
-          status="P" islast="[false]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-  <snapshots id="6" project_id="3" parent_snapshot_id="4" root_project_id="1" root_snapshot_id="2"
-          status="P" islast="[true]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="FIL" qualifier="FIL" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/before.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/before.xml
deleted file mode 100644 (file)
index 4a84a08..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<dataset>
-
-  <metrics id="1" name="revisions_by_line" description="[null]" direction="0" domain="SCM" short_name="Revisions by line" qualitative="false" val_type="DATA"
-    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
-  <metrics id="2" name="authors_by_line" description="[null]" direction="0" domain="SCM" short_name="Authors by line" qualitative="false" val_type="DATA"
-    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
-  <metrics id="3" name="last_commit_datetimes_by_line" description="[null]" direction="0" domain="SCM" short_name="Last commit dates by line" qualitative="false" val_type="DATA"
-    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
-
-  <projects id="1" uuid="uuid-MyProject" kee="MyProject" scope="PRJ" qualifier="TRK" />
-  <projects id="2" uuid="uuid-prj" kee="MyProject:src/main/xoo/prj" scope="DIR" qualifier="DIR" />
-  <projects id="3" uuid="uuid-MyFile.xoo" kee="MyProject:src/main/xoo/prj/MyFile.xoo" scope="FIL" qualifier="FIL" />
-
-  <snapshots id="1" project_id="1" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
-          status="P" islast="[false]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-  <snapshots id="2" project_id="1" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
-          status="P" islast="[true]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-
-  <snapshots id="3" project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
-          status="P" islast="[false]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-  <snapshots id="4" project_id="2" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="2"
-          status="P" islast="[true]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-
-  <snapshots id="5" project_id="3" parent_snapshot_id="3" root_project_id="1" root_snapshot_id="1"
-          status="P" islast="[false]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-  <snapshots id="6" project_id="3" parent_snapshot_id="4" root_project_id="1" root_snapshot_id="2"
-          status="P" islast="[true]" purge_status="1"
-          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
-          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
-          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
-          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
-          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
-          depth="1" scope="FIL" qualifier="FIL" created_at="2008-12-02" build_date="2011-09-29"
-          version="2.1-SNAPSHOT" path="1.2."/>
-</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesMigrationTest/schema.sql
deleted file mode 100644 (file)
index 6581817..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-
-CREATE TABLE "METRICS" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "NAME" VARCHAR(64) NOT NULL,
-  "DESCRIPTION" VARCHAR(255),
-  "DIRECTION" INTEGER NOT NULL DEFAULT 0,
-  "DOMAIN" VARCHAR(64),
-  "SHORT_NAME" VARCHAR(64),
-  "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE,
-  "VAL_TYPE" VARCHAR(8),
-  "USER_MANAGED" BOOLEAN DEFAULT FALSE,
-  "ENABLED" BOOLEAN DEFAULT TRUE,
-  "ORIGIN" VARCHAR(3),
-  "WORST_VALUE" DOUBLE,
-  "BEST_VALUE" DOUBLE,
-  "OPTIMIZED_BEST_VALUE" BOOLEAN,
-  "HIDDEN" BOOLEAN,
-  "DELETE_HISTORICAL_DATA" BOOLEAN
-);
-
-CREATE TABLE "SNAPSHOTS" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "CREATED_AT" TIMESTAMP,
-  "BUILD_DATE" TIMESTAMP,
-  "PROJECT_ID" INTEGER NOT NULL,
-  "PARENT_SNAPSHOT_ID" INTEGER,
-  "STATUS" VARCHAR(4) NOT NULL DEFAULT 'U',
-  "PURGE_STATUS" INTEGER,
-  "ISLAST" BOOLEAN NOT NULL DEFAULT FALSE,
-  "SCOPE" VARCHAR(3),
-  "QUALIFIER" VARCHAR(10),
-  "ROOT_SNAPSHOT_ID" INTEGER,
-  "VERSION" VARCHAR(500),
-  "PATH" VARCHAR(500),
-  "DEPTH" INTEGER,
-  "ROOT_PROJECT_ID" INTEGER,
-  "PERIOD1_MODE" VARCHAR(100),
-  "PERIOD1_PARAM" VARCHAR(100),
-  "PERIOD1_DATE" TIMESTAMP,
-  "PERIOD2_MODE" VARCHAR(100),
-  "PERIOD2_PARAM" VARCHAR(100),
-  "PERIOD2_DATE" TIMESTAMP,
-  "PERIOD3_MODE" VARCHAR(100),
-  "PERIOD3_PARAM" VARCHAR(100),
-  "PERIOD3_DATE" TIMESTAMP,
-  "PERIOD4_MODE" VARCHAR(100),
-  "PERIOD4_PARAM" VARCHAR(100),
-  "PERIOD4_DATE" TIMESTAMP,
-  "PERIOD5_MODE" VARCHAR(100),
-  "PERIOD5_PARAM" VARCHAR(100),
-  "PERIOD5_DATE" TIMESTAMP
-);
-
-CREATE TABLE "SNAPSHOT_SOURCES" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "SNAPSHOT_ID" INTEGER NOT NULL,
-  "UPDATED_AT" TIMESTAMP,
-  "DATA" CLOB(2147483647)
-);
-
-CREATE TABLE "PROJECTS" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "KEE" VARCHAR(400),
-  "ROOT_ID" INTEGER,
-  "UUID" VARCHAR(50),
-  "PROJECT_UUID" VARCHAR(50),
-  "MODULE_UUID" VARCHAR(50),
-  "MODULE_UUID_PATH" VARCHAR(4000),
-  "NAME" VARCHAR(256),
-  "DESCRIPTION" VARCHAR(2000),
-  "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE,
-  "SCOPE" VARCHAR(3),
-  "QUALIFIER" VARCHAR(10),
-  "DEPRECATED_KEE" VARCHAR(400),
-  "PATH" VARCHAR(2000),
-  "LANGUAGE" VARCHAR(20),
-  "COPY_RESOURCE_ID" INTEGER,
-  "LONG_NAME" VARCHAR(256),
-  "PERSON_ID" INTEGER,
-  "CREATED_AT" TIMESTAMP,
-  "AUTHORIZATION_UPDATED_AT" TIMESTAMP
-);
-
-CREATE TABLE "PROJECT_MEASURES" (
-  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "VALUE" DOUBLE,
-  "METRIC_ID" INTEGER NOT NULL,
-  "SNAPSHOT_ID" INTEGER,
-  "RULE_ID" INTEGER,
-  "RULES_CATEGORY_ID" INTEGER,
-  "TEXT_VALUE" VARCHAR(4000),
-  "TENDENCY" INTEGER,
-  "MEASURE_DATE" TIMESTAMP,
-  "PROJECT_ID" INTEGER,
-  "ALERT_STATUS" VARCHAR(5),
-  "ALERT_TEXT" VARCHAR(4000),
-  "URL" VARCHAR(2000),
-  "DESCRIPTION" VARCHAR(4000),
-  "RULE_PRIORITY" INTEGER,
-  "CHARACTERISTIC_ID" INTEGER,
-  "PERSON_ID" INTEGER,
-  "VARIATION_VALUE_1" DOUBLE,
-  "VARIATION_VALUE_2" DOUBLE,
-  "VARIATION_VALUE_3" DOUBLE,
-  "VARIATION_VALUE_4" DOUBLE,
-  "VARIATION_VALUE_5" DOUBLE,
-  "MEASURE_DATA" BINARY(167772150)
-);
-
-CREATE TABLE "FILE_SOURCES" (
-  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
-  "PROJECT_UUID" VARCHAR(50) NOT NULL,
-  "FILE_UUID" VARCHAR(50) NOT NULL,
-  "DATA" CLOB(2147483647),
-  "DATA_HASH" VARCHAR(50) NOT NULL,
-  "CREATED_AT" BIGINT NOT NULL,
-  "UPDATED_AT" BIGINT NOT NULL
-);
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/after-with-scm.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/after-with-scm.xml
new file mode 100644 (file)
index 0000000..0d6a7af
--- /dev/null
@@ -0,0 +1,8 @@
+<dataset>
+
+  <file_sources id="1" project_uuid="uuid-MyProject" file_uuid="uuid-MyFile.xoo" created_at="1416238020000" updated_at="1414770242000"
+    data="aef12a,alice,2014-04-25T12:34:56+0100,,class Foo {&#13;&#10;abe465,bob,2014-07-25T12:34:56+0100,,  // Empty&#13;&#10;afb789,carol,2014-03-23T12:34:56+0100,,}&#13;&#10;afb789,carol,2014-03-23T12:34:56+0100,,&#13;&#10;"
+    line_hashes="6a19ce786467960a3a9b0d26383a464a&#10;aab2dbc5fdeaa80b050b1d049ede357c&#10;cbb184dd8e05c9709e5dcaedaa0495cf&#10;&#10;"
+    data_hash="" />
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/after.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/after.xml
new file mode 100644 (file)
index 0000000..7a75bbc
--- /dev/null
@@ -0,0 +1,8 @@
+<dataset>
+
+  <file_sources id="1" project_uuid="uuid-MyProject" file_uuid="uuid-MyFile.xoo" created_at="1416238020000" updated_at="1414770242000"
+    data=",,,,class Foo {&#13;&#10;,,,,  // Empty&#13;&#10;,,,,}&#13;&#10;,,,,&#13;&#10;"
+    line_hashes="6a19ce786467960a3a9b0d26383a464a&#10;aab2dbc5fdeaa80b050b1d049ede357c&#10;cbb184dd8e05c9709e5dcaedaa0495cf&#10;&#10;"
+    data_hash="" />
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/before-with-scm.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/before-with-scm.xml
new file mode 100644 (file)
index 0000000..a32c8de
--- /dev/null
@@ -0,0 +1,71 @@
+<dataset>
+
+  <metrics id="1" name="revisions_by_line" description="[null]" direction="0" domain="SCM" short_name="Revisions by line" qualitative="false" val_type="DATA"
+    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
+  <metrics id="2" name="authors_by_line" description="[null]" direction="0" domain="SCM" short_name="Authors by line" qualitative="false" val_type="DATA"
+    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
+  <metrics id="3" name="last_commit_datetimes_by_line" description="[null]" direction="0" domain="SCM" short_name="Last commit dates by line" qualitative="false" val_type="DATA"
+    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
+
+  <projects id="1" uuid="uuid-MyProject" kee="MyProject" scope="PRJ" qualifier="TRK" />
+  <projects id="2" uuid="uuid-prj" kee="MyProject:src/main/xoo/prj" scope="DIR" qualifier="DIR" />
+  <projects id="3" uuid="uuid-MyFile.xoo" kee="MyProject:src/main/xoo/prj/MyFile.xoo" scope="FIL" qualifier="FIL" />
+
+  <snapshots id="1" project_id="1" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
+          status="P" islast="[false]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+  <snapshots id="2" project_id="1" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
+          status="P" islast="[true]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+
+  <snapshots id="3" project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
+          status="P" islast="[false]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+  <snapshots id="4" project_id="2" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="2"
+          status="P" islast="[true]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+
+  <snapshots id="5" project_id="3" parent_snapshot_id="3" root_project_id="1" root_snapshot_id="1"
+          status="P" islast="[false]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+  <snapshots id="6" project_id="3" parent_snapshot_id="4" root_project_id="1" root_snapshot_id="2"
+          status="P" islast="[true]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="FIL" qualifier="FIL" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/before.xml b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/before.xml
new file mode 100644 (file)
index 0000000..4a84a08
--- /dev/null
@@ -0,0 +1,70 @@
+<dataset>
+
+  <metrics id="1" name="revisions_by_line" description="[null]" direction="0" domain="SCM" short_name="Revisions by line" qualitative="false" val_type="DATA"
+    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
+  <metrics id="2" name="authors_by_line" description="[null]" direction="0" domain="SCM" short_name="Authors by line" qualitative="false" val_type="DATA"
+    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
+  <metrics id="3" name="last_commit_datetimes_by_line" description="[null]" direction="0" domain="SCM" short_name="Last commit dates by line" qualitative="false" val_type="DATA"
+    user_managed="false" enabled="true" origin="JAV" worst_value="[null]" best_value="[null]" optimized_best_value="[null]" hidden="[false]" delete_historical_data="false" />
+
+  <projects id="1" uuid="uuid-MyProject" kee="MyProject" scope="PRJ" qualifier="TRK" />
+  <projects id="2" uuid="uuid-prj" kee="MyProject:src/main/xoo/prj" scope="DIR" qualifier="DIR" />
+  <projects id="3" uuid="uuid-MyFile.xoo" kee="MyProject:src/main/xoo/prj/MyFile.xoo" scope="FIL" qualifier="FIL" />
+
+  <snapshots id="1" project_id="1" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
+          status="P" islast="[false]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+  <snapshots id="2" project_id="1" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
+          status="P" islast="[true]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="PRJ" qualifier="TRK" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+
+  <snapshots id="3" project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1"
+          status="P" islast="[false]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+  <snapshots id="4" project_id="2" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="2"
+          status="P" islast="[true]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+
+  <snapshots id="5" project_id="3" parent_snapshot_id="3" root_project_id="1" root_snapshot_id="1"
+          status="P" islast="[false]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="DIR" qualifier="DIR" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+  <snapshots id="6" project_id="3" parent_snapshot_id="4" root_project_id="1" root_snapshot_id="2"
+          status="P" islast="[true]" purge_status="1"
+          period1_mode="days1" period1_param="30" period1_date="2011-09-24"
+          period2_mode="days2" period2_param="31" period2_date="2011-09-25"
+          period3_mode="days3" period3_param="32" period3_date="2011-09-26"
+          period4_mode="days4" period4_param="33" period4_date="2011-09-27"
+          period5_mode="days5" period5_param="34" period5_date="2011-09-28"
+          depth="1" scope="FIL" qualifier="FIL" created_at="2008-12-02" build_date="2011-09-29"
+          version="2.1-SNAPSHOT" path="1.2."/>
+</dataset>
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/schema.sql b/server/sonar-server/src/test/resources/org/sonar/server/db/migrations/v50/FeedFileSourcesTest/schema.sql
new file mode 100644 (file)
index 0000000..e52c7df
--- /dev/null
@@ -0,0 +1,119 @@
+
+CREATE TABLE "METRICS" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "NAME" VARCHAR(64) NOT NULL,
+  "DESCRIPTION" VARCHAR(255),
+  "DIRECTION" INTEGER NOT NULL DEFAULT 0,
+  "DOMAIN" VARCHAR(64),
+  "SHORT_NAME" VARCHAR(64),
+  "QUALITATIVE" BOOLEAN NOT NULL DEFAULT FALSE,
+  "VAL_TYPE" VARCHAR(8),
+  "USER_MANAGED" BOOLEAN DEFAULT FALSE,
+  "ENABLED" BOOLEAN DEFAULT TRUE,
+  "ORIGIN" VARCHAR(3),
+  "WORST_VALUE" DOUBLE,
+  "BEST_VALUE" DOUBLE,
+  "OPTIMIZED_BEST_VALUE" BOOLEAN,
+  "HIDDEN" BOOLEAN,
+  "DELETE_HISTORICAL_DATA" BOOLEAN
+);
+
+CREATE TABLE "SNAPSHOTS" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "CREATED_AT" TIMESTAMP,
+  "BUILD_DATE" TIMESTAMP,
+  "PROJECT_ID" INTEGER NOT NULL,
+  "PARENT_SNAPSHOT_ID" INTEGER,
+  "STATUS" VARCHAR(4) NOT NULL DEFAULT 'U',
+  "PURGE_STATUS" INTEGER,
+  "ISLAST" BOOLEAN NOT NULL DEFAULT FALSE,
+  "SCOPE" VARCHAR(3),
+  "QUALIFIER" VARCHAR(10),
+  "ROOT_SNAPSHOT_ID" INTEGER,
+  "VERSION" VARCHAR(500),
+  "PATH" VARCHAR(500),
+  "DEPTH" INTEGER,
+  "ROOT_PROJECT_ID" INTEGER,
+  "PERIOD1_MODE" VARCHAR(100),
+  "PERIOD1_PARAM" VARCHAR(100),
+  "PERIOD1_DATE" TIMESTAMP,
+  "PERIOD2_MODE" VARCHAR(100),
+  "PERIOD2_PARAM" VARCHAR(100),
+  "PERIOD2_DATE" TIMESTAMP,
+  "PERIOD3_MODE" VARCHAR(100),
+  "PERIOD3_PARAM" VARCHAR(100),
+  "PERIOD3_DATE" TIMESTAMP,
+  "PERIOD4_MODE" VARCHAR(100),
+  "PERIOD4_PARAM" VARCHAR(100),
+  "PERIOD4_DATE" TIMESTAMP,
+  "PERIOD5_MODE" VARCHAR(100),
+  "PERIOD5_PARAM" VARCHAR(100),
+  "PERIOD5_DATE" TIMESTAMP
+);
+
+CREATE TABLE "SNAPSHOT_SOURCES" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "SNAPSHOT_ID" INTEGER NOT NULL,
+  "UPDATED_AT" TIMESTAMP,
+  "DATA" CLOB(2147483647)
+);
+
+CREATE TABLE "PROJECTS" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "KEE" VARCHAR(400),
+  "ROOT_ID" INTEGER,
+  "UUID" VARCHAR(50),
+  "PROJECT_UUID" VARCHAR(50),
+  "MODULE_UUID" VARCHAR(50),
+  "MODULE_UUID_PATH" VARCHAR(4000),
+  "NAME" VARCHAR(256),
+  "DESCRIPTION" VARCHAR(2000),
+  "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE,
+  "SCOPE" VARCHAR(3),
+  "QUALIFIER" VARCHAR(10),
+  "DEPRECATED_KEE" VARCHAR(400),
+  "PATH" VARCHAR(2000),
+  "LANGUAGE" VARCHAR(20),
+  "COPY_RESOURCE_ID" INTEGER,
+  "LONG_NAME" VARCHAR(256),
+  "PERSON_ID" INTEGER,
+  "CREATED_AT" TIMESTAMP,
+  "AUTHORIZATION_UPDATED_AT" TIMESTAMP
+);
+
+CREATE TABLE "PROJECT_MEASURES" (
+  "ID" BIGINT NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "VALUE" DOUBLE,
+  "METRIC_ID" INTEGER NOT NULL,
+  "SNAPSHOT_ID" INTEGER,
+  "RULE_ID" INTEGER,
+  "RULES_CATEGORY_ID" INTEGER,
+  "TEXT_VALUE" VARCHAR(4000),
+  "TENDENCY" INTEGER,
+  "MEASURE_DATE" TIMESTAMP,
+  "PROJECT_ID" INTEGER,
+  "ALERT_STATUS" VARCHAR(5),
+  "ALERT_TEXT" VARCHAR(4000),
+  "URL" VARCHAR(2000),
+  "DESCRIPTION" VARCHAR(4000),
+  "RULE_PRIORITY" INTEGER,
+  "CHARACTERISTIC_ID" INTEGER,
+  "PERSON_ID" INTEGER,
+  "VARIATION_VALUE_1" DOUBLE,
+  "VARIATION_VALUE_2" DOUBLE,
+  "VARIATION_VALUE_3" DOUBLE,
+  "VARIATION_VALUE_4" DOUBLE,
+  "VARIATION_VALUE_5" DOUBLE,
+  "MEASURE_DATA" BINARY(167772150)
+);
+
+CREATE TABLE "FILE_SOURCES" (
+  "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1),
+  "PROJECT_UUID" VARCHAR(50) NOT NULL,
+  "FILE_UUID" VARCHAR(50) NOT NULL,
+  "DATA" CLOB(2147483647),
+  "LINE_HASHES" CLOB(2147483647),
+  "DATA_HASH" VARCHAR(50) NOT NULL,
+  "CREATED_AT" BIGINT NOT NULL,
+  "UPDATED_AT" BIGINT NOT NULL
+);