diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-02-16 18:55:30 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2016-02-17 11:53:29 +0100 |
commit | d16562b8ee9ff9f73c73fa83147be8632a6c1e70 (patch) | |
tree | 42a8ed601575e61ebfbaa47e66691412b2c9caf4 /sonar-db | |
parent | 9194c3363d91e37af5a4ab08d06e0e1e52194a6d (diff) | |
download | sonarqube-d16562b8ee9ff9f73c73fa83147be8632a6c1e70.tar.gz sonarqube-d16562b8ee9ff9f73c73fa83147be8632a6c1e70.zip |
SONAR-7330 Add rules long date columns
Diffstat (limited to 'sonar-db')
15 files changed, 396 insertions, 9 deletions
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 2f78c414235..ec8ebbc2ba8 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 @@ -29,7 +29,7 @@ import org.sonar.db.MyBatis; public class DatabaseVersion { - public static final int LAST_VERSION = 1017; + public static final int LAST_VERSION = 1101; /** * The minimum supported version which can be upgraded. Lower diff --git a/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java b/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java index 96e0865367a..1c472d444fb 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java +++ b/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java @@ -69,6 +69,8 @@ import org.sonar.db.version.v54.MigrateQualityGatesConditions; import org.sonar.db.version.v54.MigrateUsersIdentity; import org.sonar.db.version.v54.RemoveComponentPageProperties; import org.sonar.db.version.v54.RemovePreviewPermission; +import org.sonar.db.version.v55.AddRulesLongDateColumns; +import org.sonar.db.version.v55.FeedRulesLongDateColumns; public class MigrationStepModule extends Module { @Override @@ -133,7 +135,11 @@ public class MigrationStepModule extends Module { MigrateQualityGatesConditions.class, MigrateDisabledUsersToOnlyKeepLoginAndName.class, RemovePreviewPermission.class, - IncreaseProjectsNameColumnsSize.class + IncreaseProjectsNameColumnsSize.class, + + // 5.5 + AddRulesLongDateColumns.class, + FeedRulesLongDateColumns.class ); } } diff --git a/sonar-db/src/main/java/org/sonar/db/version/v55/AddRulesLongDateColumns.java b/sonar-db/src/main/java/org/sonar/db/version/v55/AddRulesLongDateColumns.java new file mode 100644 index 00000000000..727d927e2b8 --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/db/version/v55/AddRulesLongDateColumns.java @@ -0,0 +1,55 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program 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. + * + * This program 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.db.version.v55; + +import java.sql.SQLException; +import org.sonar.db.Database; +import org.sonar.db.version.AddColumnsBuilder; +import org.sonar.db.version.DdlChange; + +import static org.sonar.db.version.BigDecimalColumnDef.newBigDecimalColumnDefBuilder; + +/** + * Add the following columns to the rules table : + * - created_at_ms + * - updated_at_ms + */ +public class AddRulesLongDateColumns extends DdlChange { + + private final Database db; + + public AddRulesLongDateColumns(Database db) { + super(db); + this.db = db; + } + + @Override + public void execute(Context context) throws SQLException { + context.execute(generateSql()); + } + + private String generateSql() { + return new AddColumnsBuilder(db.getDialect(), "rules") + .addColumn(newBigDecimalColumnDefBuilder().setColumnName("created_at_ms").setIsNullable(true).build()) + .addColumn(newBigDecimalColumnDefBuilder().setColumnName("updated_at_ms").setIsNullable(true).build()) + .build(); + } + +} diff --git a/sonar-db/src/main/java/org/sonar/db/version/v55/FeedRulesLongDateColumns.java b/sonar-db/src/main/java/org/sonar/db/version/v55/FeedRulesLongDateColumns.java new file mode 100644 index 00000000000..7325ff93f95 --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/db/version/v55/FeedRulesLongDateColumns.java @@ -0,0 +1,80 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program 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. + * + * This program 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.db.version.v55; + +import java.sql.SQLException; +import java.util.Date; +import org.sonar.api.utils.System2; +import org.sonar.db.Database; +import org.sonar.db.version.BaseDataChange; +import org.sonar.db.version.MassUpdate; +import org.sonar.db.version.Select; +import org.sonar.db.version.SqlStatement; + +public class FeedRulesLongDateColumns extends BaseDataChange { + + private final System2 system; + + public FeedRulesLongDateColumns(Database db, System2 system) { + super(db); + this.system = system; + } + + @Override + public void execute(Context context) throws SQLException { + final long now = system.now(); + + MassUpdate massUpdate = context.prepareMassUpdate(); + massUpdate.select("SELECT r.id, r.created_at, r.updated_at FROM rules r WHERE created_at_ms IS NULL OR updated_at_ms IS NULL"); + massUpdate.update("UPDATE rules SET created_at_ms=?, updated_at_ms=? WHERE id=?"); + massUpdate.rowPluralName("rules"); + massUpdate.execute(new MigrationHandler(now)); + } + + private static class MigrationHandler implements MassUpdate.Handler{ + + private final long now; + + public MigrationHandler(long now) { + this.now = now; + } + + @Override + public boolean handle(Select.Row row, SqlStatement update) throws SQLException { + Long id = row.getNullableLong(1); + Date createdAt = row.getNullableDate(2); + Date updatedAt = row.getNullableDate(3); + + if (createdAt == null) { + update.setLong(1, now); + } else { + update.setLong(1, Math.min(now, createdAt.getTime())); + } + if (updatedAt == null) { + update.setLong(2, now); + } else { + update.setLong(2, Math.min(now, updatedAt.getTime())); + } + update.setLong(3, id); + return true; + } + } + +} diff --git a/sonar-db/src/main/java/org/sonar/db/version/v55/package-info.java b/sonar-db/src/main/java/org/sonar/db/version/v55/package-info.java new file mode 100644 index 00000000000..c6e3adbdc98 --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/db/version/v55/package-info.java @@ -0,0 +1,24 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program 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. + * + * This program 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. + */ +@ParametersAreNonnullByDefault +package org.sonar.db.version.v55; + +import javax.annotation.ParametersAreNonnullByDefault; + 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 1b93040984a..0d25eca3ba1 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 @@ -377,6 +377,8 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1013'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1014'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1015'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1017'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1100'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1101'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, EXTERNAL_IDENTITY, EXTERNAL_IDENTITY_PROVIDER, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'admin', 'sonarqube', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null); 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 d4fb90a114e..37bcdbd716a 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 @@ -143,7 +143,9 @@ CREATE TABLE "RULES" ( "TAGS" VARCHAR(4000), "SYSTEM_TAGS" VARCHAR(4000), "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP + "UPDATED_AT" TIMESTAMP, + "CREATED_AT_MS" BIGINT, + "UPDATED_AT_MS" BIGINT ); diff --git a/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java b/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java index c766bebda7d..a3153c66f31 100644 --- a/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java +++ b/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java @@ -29,6 +29,6 @@ public class MigrationStepModuleTest { public void verify_count_of_added_MigrationStep_types() { ComponentContainer container = new ComponentContainer(); new MigrationStepModule().configure(container); - assertThat(container.size()).isEqualTo(51); + assertThat(container.size()).isEqualTo(53); } } diff --git a/sonar-db/src/test/java/org/sonar/db/version/v55/AddRulesLongDateColumnsTest.java b/sonar-db/src/test/java/org/sonar/db/version/v55/AddRulesLongDateColumnsTest.java new file mode 100644 index 00000000000..8e29ecb328b --- /dev/null +++ b/sonar-db/src/test/java/org/sonar/db/version/v55/AddRulesLongDateColumnsTest.java @@ -0,0 +1,50 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program 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. + * + * This program 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.db.version.v55; + +import java.sql.Types; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.sonar.api.utils.System2; +import org.sonar.db.DbTester; +import org.sonar.db.version.MigrationStep; + +public class AddRulesLongDateColumnsTest { + + @Rule + public DbTester db = DbTester.createForSchema(System2.INSTANCE, AddRulesLongDateColumnsTest.class, "schema.sql"); + + MigrationStep migration; + + @Before + public void setUp() { + migration = new AddRulesLongDateColumns(db.database()); + } + + @Test + public void update_columns() throws Exception { + migration.execute(); + + db.assertColumnDefinition("rules", "created_at_ms", Types.BIGINT, null); + db.assertColumnDefinition("rules", "updated_at_ms", Types.BIGINT, null); + } + +} diff --git a/sonar-db/src/test/java/org/sonar/db/version/v55/FeedRulesLongDateColumnsTest.java b/sonar-db/src/test/java/org/sonar/db/version/v55/FeedRulesLongDateColumnsTest.java new file mode 100644 index 00000000000..84da34783be --- /dev/null +++ b/sonar-db/src/test/java/org/sonar/db/version/v55/FeedRulesLongDateColumnsTest.java @@ -0,0 +1,60 @@ +/* + * SonarQube + * Copyright (C) 2009-2016 SonarSource SA + * mailto:contact AT sonarsource DOT com + * + * This program 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. + * + * This program 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.db.version.v55; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.sonar.api.utils.System2; +import org.sonar.db.DbTester; +import org.sonar.db.version.MigrationStep; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class FeedRulesLongDateColumnsTest { + + @Rule + public DbTester db = DbTester.createForSchema(System2.INSTANCE, FeedRulesLongDateColumnsTest.class, "schema.sql"); + + static final long NOW = 1500000000000L; + + System2 system = mock(System2.class); + + MigrationStep migration = new FeedRulesLongDateColumns(db.database(), system); + + @Before + public void setUp() throws Exception { + when(system.now()).thenReturn(NOW); + } + + @Test + public void execute() throws Exception { + db.prepareDbUnit(getClass(), "execute.xml"); + + migration.execute(); + + assertThat(db.countSql("select count(*) from rules where created_at_ms is not null and updated_at_ms is not null")).isEqualTo(3); + // Only 1 rules not updated + assertThat(db.countSql("select count(*) from rules where created_at_ms='1000000000000' and updated_at_ms='1000000000000'")).isEqualTo(1); + } + +} diff --git a/sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectEnabledAndNonManual.xml b/sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectEnabledAndNonManual.xml index fe85e591078..59a8dae0f4f 100644 --- a/sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectEnabledAndNonManual.xml +++ b/sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/selectEnabledAndNonManual.xml @@ -6,7 +6,10 @@ remediation_function="LINEAR" default_remediation_function="LINEAR_OFFSET" remediation_coeff="1h" default_remediation_coeff="5d" remediation_offset="5min" default_remediation_offset="10h" - effort_to_fix_description="squid.S115.effortToFix"/> + effort_to_fix_description="squid.S115.effortToFix" + created_at="2014-05-10" updated_at="2014-05-11" + created_at_ms="1500000000000" updated_at_ms="1600000000000" + /> <rules tags="[null]" system_tags="[null]" id="2" plugin_rule_key="AvoidNull" plugin_name="squid" name="Avoid Null" description="Should avoid NULL" status="REMOVED" note_data="[null]" note_user_login="[null]" note_created_at="[null]" description_format="HTML" @@ -14,7 +17,10 @@ remediation_function="[null]" default_remediation_function="[null]" remediation_coeff="[null]" default_remediation_coeff="[null]" remediation_offset="[null]" default_remediation_offset="[null]" - effort_to_fix_description="[null]"/> + effort_to_fix_description="[null]" + created_at="2014-05-10" updated_at="2014-05-11" + created_at_ms="1500000000000" updated_at_ms="1600000000000" + /> <rules tags="[null]" system_tags="[null]" id="3" plugin_rule_key="AvoidNull" plugin_name="manual" name="Manual Rule" description="Should not appear" status="READY" note_data="[null]" note_user_login="[null]" note_created_at="[null]" description_format="HTML" @@ -22,6 +28,9 @@ remediation_function="[null]" default_remediation_function="[null]" remediation_coeff="[null]" default_remediation_coeff="[null]" remediation_offset="[null]" default_remediation_offset="[null]" - effort_to_fix_description="[null]"/> + effort_to_fix_description="[null]" + created_at="2014-05-10" updated_at="2014-05-11" + created_at_ms="1500000000000" updated_at_ms="1600000000000" + /> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/shared.xml b/sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/shared.xml index d7d86c81a35..ff4211adfce 100644 --- a/sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/shared.xml +++ b/sonar-db/src/test/resources/org/sonar/db/rule/RuleDaoTest/shared.xml @@ -3,10 +3,16 @@ <rules id="1" name="Null Pointer" plugin_rule_key="S001" plugin_config_key="S1" plugin_name="java" description="[null]" priority="4" status="READY" is_template="[false]" template_id="[null]" - tags="bug,performance" system_tags="cwe" /> + tags="bug,performance" system_tags="cwe" + created_at="2014-05-10" updated_at="2014-05-11" + created_at_ms="1500000000000" updated_at_ms="1600000000000" + /> <rules id="2" name="Slow" plugin_rule_key="S002" plugin_config_key="S2" plugin_name="java" description="[null]" priority="4" status="BETA" is_template="[false]" template_id="[null]" - tags="[null]" system_tags="[null]" /> + tags="[null]" system_tags="[null]" + created_at="2014-05-10" updated_at="2014-05-11" + created_at_ms="1500000000000" updated_at_ms="1600000000000" + /> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v55/AddRulesLongDateColumnsTest/schema.sql b/sonar-db/src/test/resources/org/sonar/db/version/v55/AddRulesLongDateColumnsTest/schema.sql new file mode 100644 index 00000000000..0c7c17f13f8 --- /dev/null +++ b/sonar-db/src/test/resources/org/sonar/db/version/v55/AddRulesLongDateColumnsTest/schema.sql @@ -0,0 +1,31 @@ +CREATE TABLE "RULES" ( + "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, + "PLUGIN_NAME" VARCHAR(255) NOT NULL, + "DESCRIPTION" VARCHAR(16777215), + "DESCRIPTION_FORMAT" VARCHAR(20), + "PRIORITY" INTEGER, + "IS_TEMPLATE" BOOLEAN DEFAULT FALSE, + "TEMPLATE_ID" INTEGER, + "PLUGIN_CONFIG_KEY" VARCHAR(500), + "NAME" VARCHAR(200), + "STATUS" VARCHAR(40), + "LANGUAGE" VARCHAR(20), + "NOTE_DATA" CLOB(2147483647), + "NOTE_USER_LOGIN" VARCHAR(255), + "NOTE_CREATED_AT" TIMESTAMP, + "NOTE_UPDATED_AT" TIMESTAMP, + "CHARACTERISTIC_ID" INTEGER, + "DEFAULT_CHARACTERISTIC_ID" INTEGER, + "REMEDIATION_FUNCTION" VARCHAR(20), + "DEFAULT_REMEDIATION_FUNCTION" VARCHAR(20), + "REMEDIATION_COEFF" VARCHAR(20), + "DEFAULT_REMEDIATION_COEFF" VARCHAR(20), + "REMEDIATION_OFFSET" VARCHAR(20), + "DEFAULT_REMEDIATION_OFFSET" VARCHAR(20), + "EFFORT_TO_FIX_DESCRIPTION" VARCHAR(4000), + "TAGS" VARCHAR(4000), + "SYSTEM_TAGS" VARCHAR(4000), + "CREATED_AT" TIMESTAMP, + "UPDATED_AT" TIMESTAMP +); diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v55/FeedRulesLongDateColumnsTest/execute.xml b/sonar-db/src/test/resources/org/sonar/db/version/v55/FeedRulesLongDateColumnsTest/execute.xml new file mode 100644 index 00000000000..e46c1ac2ac2 --- /dev/null +++ b/sonar-db/src/test/resources/org/sonar/db/version/v55/FeedRulesLongDateColumnsTest/execute.xml @@ -0,0 +1,29 @@ +<dataset> + + <rules id="1" name="Null Pointer" plugin_rule_key="S001" + plugin_config_key="S1" plugin_name="java" description="[null]" priority="4" status="READY" + is_template="[false]" template_id="[null]" + tags="bug,performance" system_tags="cwe" + created_at="2014-05-12" updated_at="2014-05-13" + created_at_ms="[null]" updated_at_ms="[null]" + /> + + <!-- re-entrant migration - ignore the issues that are already fed with new dates --> + <rules id="2" name="Slow" plugin_rule_key="S002" + plugin_config_key="S2" plugin_name="java" description="[null]" priority="4" status="BETA" + is_template="[false]" template_id="[null]" + tags="[null]" system_tags="[null]" + created_at="2014-05-10" updated_at="2014-05-11" + created_at_ms="1000000000000" updated_at_ms="1000000000000" + /> + + <!-- NULL dates --> + <rules id="3" name="Down" plugin_rule_key="S003" + plugin_config_key="S3" plugin_name="java" description="[null]" priority="4" status="BETA" + is_template="[false]" template_id="[null]" + tags="[null]" system_tags="[null]" + created_at="[null]" updated_at="[null]" + created_at_ms="[null]" updated_at_ms="[null]" + /> + +</dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v55/FeedRulesLongDateColumnsTest/schema.sql b/sonar-db/src/test/resources/org/sonar/db/version/v55/FeedRulesLongDateColumnsTest/schema.sql new file mode 100644 index 00000000000..39f299d68c6 --- /dev/null +++ b/sonar-db/src/test/resources/org/sonar/db/version/v55/FeedRulesLongDateColumnsTest/schema.sql @@ -0,0 +1,33 @@ +CREATE TABLE "RULES" ( + "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + "PLUGIN_RULE_KEY" VARCHAR(200) NOT NULL, + "PLUGIN_NAME" VARCHAR(255) NOT NULL, + "DESCRIPTION" VARCHAR(16777215), + "DESCRIPTION_FORMAT" VARCHAR(20), + "PRIORITY" INTEGER, + "IS_TEMPLATE" BOOLEAN DEFAULT FALSE, + "TEMPLATE_ID" INTEGER, + "PLUGIN_CONFIG_KEY" VARCHAR(500), + "NAME" VARCHAR(200), + "STATUS" VARCHAR(40), + "LANGUAGE" VARCHAR(20), + "NOTE_DATA" CLOB(2147483647), + "NOTE_USER_LOGIN" VARCHAR(255), + "NOTE_CREATED_AT" TIMESTAMP, + "NOTE_UPDATED_AT" TIMESTAMP, + "CHARACTERISTIC_ID" INTEGER, + "DEFAULT_CHARACTERISTIC_ID" INTEGER, + "REMEDIATION_FUNCTION" VARCHAR(20), + "DEFAULT_REMEDIATION_FUNCTION" VARCHAR(20), + "REMEDIATION_COEFF" VARCHAR(20), + "DEFAULT_REMEDIATION_COEFF" VARCHAR(20), + "REMEDIATION_OFFSET" VARCHAR(20), + "DEFAULT_REMEDIATION_OFFSET" VARCHAR(20), + "EFFORT_TO_FIX_DESCRIPTION" VARCHAR(4000), + "TAGS" VARCHAR(4000), + "SYSTEM_TAGS" VARCHAR(4000), + "CREATED_AT" TIMESTAMP, + "UPDATED_AT" TIMESTAMP, + "CREATED_AT_MS" BIGINT, + "UPDATED_AT_MS" BIGINT +); |