From fc869a7a3960e16242a277937dbf9450915824dd Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Tue, 30 Aug 2016 17:27:28 +0200 Subject: [PATCH] SONAR-7675 add table INTERNAL_PROPERTIES --- .../1310_create_internal_properties_table.rb | 37 +++++++++++++++++++ .../org/sonar/db/version/DatabaseVersion.java | 3 +- .../org/sonar/db/version/rows-h2.sql | 1 + .../org/sonar/db/version/schema-h2.ddl | 10 +++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1310_create_internal_properties_table.rb diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1310_create_internal_properties_table.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1310_create_internal_properties_table.rb new file mode 100644 index 00000000000..55f8870ac3f --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1310_create_internal_properties_table.rb @@ -0,0 +1,37 @@ +# +# 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 CreateInternalPropertiesTable < ActiveRecord::Migration + + def self.up + create_table 'internal_properties', :id => false do |t| + t.column 'kee', :string, :limit => 20, :null => false + t.column 'is_empty', :boolean, :null => false + t.column 'text_value', :string, :limit => 4000, :null => true + t.column 'clob_value', :text, :null => true + t.column 'created_at', :big_integer, :null => false + end + add_primary_key 'internal_properties', 'kee' + 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 9f1689a6888..0645ef93da6 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_309; + public static final int LAST_VERSION = 1_310; /** * The minimum supported version which can be upgraded. Lower @@ -82,6 +82,7 @@ public class DatabaseVersion { "project_measures", "project_qprofiles", "properties", + "internal_properties", "resource_index", "rules", "rules_parameters", 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 4c6a4beb808..48eccb51e08 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 ('1306'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1307'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1309'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1310'); 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 afbe2031221..a37f25ac7dc 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 @@ -207,6 +207,14 @@ CREATE TABLE "PROJECT_MEASURES" ( "MEASURE_DATA" BINARY(167772150) ); +CREATE TABLE "INTERNAL_PROPERTIES" ( + "KEE" VARCHAR(50) NOT NULL PRIMARY KEY, + "IS_EMPTY" BOOLEAN NOT NULL, + "TEXT_VALUE" VARCHAR(4000), + "CLOB_VALUE" CLOB, + "CREATED_AT" BIGINT +); + CREATE TABLE "PROJECTS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "KEE" VARCHAR(400), @@ -701,3 +709,5 @@ CREATE INDEX "CE_ACTIVITY_ISLASTKEY" ON "CE_ACTIVITY" ("IS_LAST_KEY"); CREATE INDEX "CE_ACTIVITY_ISLAST_STATUS" ON "CE_ACTIVITY" ("IS_LAST", "STATUS"); CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS" ("TEMPLATE_ID", "PERMISSION_KEY"); + +CREATE UNIQUE INDEX "UNIQ_INTERNAL_PROPERTIES" ON "INTERNAL_PROPERTIES" ("KEE"); -- 2.39.5