aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-12-04 10:53:11 +0100
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>2014-12-04 12:23:32 +0100
commit4e368ea5a4beb449110146800597ade3459e667f (patch)
tree4b12fb9b9801b59210dfdb3e5e650b28972de358
parentf0780bc3b1b14bfb4a88379e719d58366668b1a0 (diff)
downloadsonarqube-4e368ea5a4beb449110146800597ade3459e667f.tar.gz
sonarqube-4e368ea5a4beb449110146800597ade3459e667f.zip
SONAR-5869 Drop snapshot_sources table
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/db/migrate/717_drop_snapshot_sources.rb32
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java3
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql1
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl9
5 files changed, 35 insertions, 12 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java b/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java
index 829b7d3ef62..78a1b297eb1 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java
@@ -37,7 +37,7 @@ public class BackendCleanup implements ServerComponent {
private static final String[] INSPECTION_TABLES = {
"action_plans", "authors", "dependencies", "duplications_index", "events", "graphs", "issues", "issue_changes", "manual_measures",
"notifications", "project_links", "project_measures", "projects", "resource_index",
- "semaphores", "snapshot_sources", "snapshots", "snapshot_data", "file_sources"
+ "semaphores", "snapshots", "snapshot_data", "file_sources"
};
private static final String[] RESOURCE_RELATED_TABLES = {
"group_roles", "user_roles", "properties"
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/717_drop_snapshot_sources.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/717_drop_snapshot_sources.rb
new file mode 100644
index 00000000000..67fa599ab51
--- /dev/null
+++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/717_drop_snapshot_sources.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.0
+# SONAR-5589
+#
+class DropSnapshotSources < ActiveRecord::Migration
+
+ def self.up
+ remove_index :snapshot_sources, :name => 'snap_sources_snapshot_id'
+ drop_table :snapshot_sources
+ end
+
+end
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 73f373f6a3d..783c7433141 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 = 716;
+ public static final int LAST_VERSION = 717;
/**
* List of all the tables.
* This list is hardcoded because we didn't succeed in using java.sql.DatabaseMetaData#getTables() in the same way
@@ -83,7 +83,6 @@ public class DatabaseVersion implements BatchComponent, ServerComponent {
"semaphores",
"schema_migrations",
"snapshots",
- "snapshot_sources",
"snapshot_data",
"users",
"user_roles",
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 4a0311f3d17..eb87903bbb9 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
@@ -274,6 +274,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('713');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('714');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('715');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('716');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('717');
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', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', 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 722be701b68..c148b9eada9 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
@@ -244,13 +244,6 @@ CREATE TABLE "PROJECT_MEASURES" (
"MEASURE_DATA" BINARY(167772150)
);
-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),
@@ -597,8 +590,6 @@ CREATE INDEX "DUPLICATIONS_INDEX_SID" ON "DUPLICATIONS_INDEX" ("SNAPSHOT_ID");
CREATE INDEX "DUPLICATIONS_INDEX_PSID" ON "DUPLICATIONS_INDEX" ("PROJECT_SNAPSHOT_ID");
-CREATE INDEX "SNAP_SOURCES_SNAPSHOT_ID" ON "SNAPSHOT_SOURCES" ("SNAPSHOT_ID");
-
CREATE INDEX "INDEX_GROUPS_USERS_ON_GROUP_ID" ON "GROUPS_USERS" ("GROUP_ID");
CREATE INDEX "INDEX_GROUPS_USERS_ON_USER_ID" ON "GROUPS_USERS" ("USER_ID");