From 0fc1b325a335c9ecad906908d2c8d87c12f0f976 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 9 Sep 2016 10:07:35 +0200 Subject: [PATCH] SONAR-7851 create table qprofile_changes --- .../1316_create_table_qprofile_changes.rb | 37 +++++++++++++++++++ .../org/sonar/db/version/DatabaseVersion.java | 5 ++- .../org/sonar/db/version/rows-h2.sql | 1 + .../org/sonar/db/version/schema-h2.ddl | 11 ++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1316_create_table_qprofile_changes.rb diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1316_create_table_qprofile_changes.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1316_create_table_qprofile_changes.rb new file mode 100644 index 00000000000..1d9a88dd95e --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1316_create_table_qprofile_changes.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 CreateTableQprofileChanges < ActiveRecord::Migration + + def self.up + create_table 'qprofile_changes', :id => false do |t| + t.column 'kee', :string, :limit => 40, :null => false + t.column 'qprofile_key', :string, :limit => 40, :null => false + t.column 'change_type', :string, :limit => 20, :null => false + t.column 'created_at', :big_integer, :null => false + t.column 'user_login', :string, :limit => 255, :null => true + t.column 'data', :text, :null => true + end + add_primary_key 'qprofile_changes', '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 223a31f3da1..34cd448686e 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_315; + public static final int LAST_VERSION = 1_316; /** * The minimum supported version which can be upgraded. Lower @@ -61,6 +61,7 @@ public class DatabaseVersion { "groups", "groups_users", "group_roles", + "internal_properties", "issues", "issue_changes", "issue_filters", @@ -82,7 +83,7 @@ public class DatabaseVersion { "project_measures", "project_qprofiles", "properties", - "internal_properties", + "qprofile_changes", "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 490f32a1030..f5c3897d4da 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 @@ -500,6 +500,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1312'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1313'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1314'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1315'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1316'); 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 ce442a99309..6569864cb03 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 @@ -501,6 +501,15 @@ CREATE TABLE "ACTIVITIES" ( "DATA_FIELD" CLOB(2147483647) ); +CREATE TABLE "QPROFILE_CHANGES" ( + "KEE" VARCHAR(40) NOT NULL PRIMARY KEY, + "QPROFILE_KEY" VARCHAR(255) NOT NULL, + "CHANGE_TYPE" VARCHAR(20) NOT NULL, + "CREATED_AT" BIGINT NOT NULL, + "USER_LOGIN" VARCHAR(255), + "DATA" CLOB +); + 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, @@ -714,3 +723,5 @@ 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"); + +CREATE INDEX "QPROFILE_CHANGES_QPROFILE_KEY" ON "QPROFILE_CHANGES" ("QPROFILE_KEY"); -- 2.39.5