From 6dac2f2642d8ac888e1c07066f2081b61ea37ae3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Wed, 17 Aug 2016 12:15:00 +0200 Subject: [PATCH] SONAR-7844 add table SCANNER_CONTEXT --- .../1308_create_table_scanner_context.rb | 35 +++++++++++++++++++ .../org/sonar/db/version/DatabaseVersion.java | 3 +- .../org/sonar/db/version/rows-h2.sql | 1 + .../org/sonar/db/version/schema-h2.ddl | 11 +++++- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1308_create_table_scanner_context.rb diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1308_create_table_scanner_context.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1308_create_table_scanner_context.rb new file mode 100644 index 00000000000..c225404d95a --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1308_create_table_scanner_context.rb @@ -0,0 +1,35 @@ +# +# 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 6.1 +# +class CreateTableScannerContext < ActiveRecord::Migration + + def self.up + create_table 'scanner_context', :id => false do |t| + t.column 'analysis_uuid', :string, :limit => 40, :null => false + t.column 'data', :binary, :null => false + t.column 'created_at', :big_integer, :null => false + t.column 'updated_at', :big_integer, :null => false + end + add_index 'scanner_context', 'analysis_uuid', :name => 'scanner_context_analysis_uuid', :unique => true + end +end diff --git a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java index bb811799f64..5cfbc9481ce 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java +++ b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java @@ -30,7 +30,7 @@ import org.sonar.db.MyBatis; public class DatabaseVersion { - public static final int LAST_VERSION = 1_307; + public static final int LAST_VERSION = 1_308; /** * The minimum supported version which can be upgraded. Lower @@ -85,6 +85,7 @@ public class DatabaseVersion { "rules", "rules_parameters", "rules_profiles", + "scanner_context", "schema_migrations", "snapshots", "users", 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 bb91bf092de..805e21cd2b2 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 @@ -494,6 +494,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1304'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1305'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1306'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1307'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1308'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, EXTERNAL_IDENTITY, EXTERNAL_IDENTITY_PROVIDER, USER_LOCAL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT) VALUES (1, 'admin', 'Administrator', '', 'admin', 'sonarqube', true, 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482'); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; 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 af0ca243a0d..7559720c657 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 @@ -81,8 +81,15 @@ CREATE TABLE "SNAPSHOTS" ( "PERIOD5_DATE" BIGINT ); +CREATE TABLE "SCANNER_CONTEXT" ( + "ANALYSIS_UUID" VARCHAR(40) NOT NULL, + "DATA" BLOB(167772150) NOT NULL, + "CREATED_AT" BIGINT NOT NULL, + "UPDATED_AT" BIGINT NOT NULL +); + CREATE TABLE "SCHEMA_MIGRATIONS" ( -"VERSION" VARCHAR(256) NOT NULL + "VERSION" VARCHAR(256) NOT NULL ); CREATE TABLE "GROUP_ROLES" ( @@ -696,3 +703,5 @@ CREATE INDEX "CE_ACTIVITY_ISLAST_STATUS" ON "CE_ACTIVITY" ("IS_LAST", "STATUS"); CREATE UNIQUE INDEX "CE_TASK_INPUT_UUID" ON "CE_TASK_INPUT" ("TASK_UUID"); CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS" ("TEMPLATE_ID", "PERMISSION_KEY"); + +CREATE UNIQUE INDEX "SCANNER_CONTEXT_ANALYSIS_UUID" ON "SCANNER_CONTEXT" ("ANALYSIS_UUID"); -- 2.39.5