diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2023-11-10 10:05:16 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-11-17 20:03:00 +0000 |
commit | fcc198287c941c2a785fb6d335360f3bd775b09a (patch) | |
tree | 8364f7fe82f25f57406d68e0a026e6ed91803abb /server | |
parent | 73847ed622327b13d9def3ca5a6f925f2f69e49a (diff) | |
download | sonarqube-fcc198287c941c2a785fb6d335360f3bd775b09a.tar.gz sonarqube-fcc198287c941c2a785fb6d335360f3bd775b09a.zip |
SONAR-21002 Improve DB migration tests to use actual migration instead of schema.sql
Diffstat (limited to 'server')
230 files changed, 711 insertions, 3819 deletions
diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java index 27e355543d6..4e328ad86de 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/DefaultDatabase.java @@ -31,9 +31,9 @@ import java.util.Properties; import java.util.Set; import javax.sql.DataSource; import org.apache.commons.lang.StringUtils; -import org.sonar.api.config.internal.Settings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.sonar.api.config.internal.Settings; import org.sonar.db.dialect.Dialect; import org.sonar.db.dialect.DialectUtils; import org.sonar.db.profiling.NullConnectionInterceptor; @@ -256,4 +256,8 @@ public class DefaultDatabase implements Database { public String toString() { return format("Database[%s]", properties != null ? properties.getProperty(JDBC_URL.getKey()) : "?"); } + + public Settings getSettings() { + return settings; + } } diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java b/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java index 068bc3ee00c..37cd0c23a6f 100644 --- a/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java +++ b/server/sonar-db-core/src/test/java/org/sonar/db/DefaultDatabaseTest.java @@ -58,6 +58,13 @@ public class DefaultDatabaseTest { } @Test + public void getSettings_shouldReturnExpectedSettings() { + MapSettings settings = new MapSettings(); + settings.setProperty("test", "test"); + DefaultDatabase db = new DefaultDatabase(logbackHelper, settings); + assertThat(db.getSettings()).isEqualTo(settings); + } + @Test public void shouldExtractHikariProperties() { Properties props = new Properties(); props.setProperty("sonar.jdbc.driverClassName", "my.Driver"); diff --git a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java index 066c6e16208..3e29a5a66bf 100644 --- a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java +++ b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreTestDb.java @@ -19,22 +19,17 @@ */ package org.sonar.db; -import java.sql.Connection; -import java.sql.ResultSet; import java.sql.SQLException; -import java.sql.Statement; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; import javax.annotation.Nullable; -import javax.sql.DataSource; import org.apache.commons.codec.digest.DigestUtils; import org.junit.AssumptionViolatedException; -import org.sonar.api.config.internal.MapSettings; -import org.sonar.api.config.internal.Settings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonar.db.version.SqTables; +import org.sonar.api.config.internal.MapSettings; +import org.sonar.api.config.internal.Settings; import static java.util.Objects.requireNonNull; import static org.sonar.process.ProcessProperties.Property.JDBC_USERNAME; @@ -132,48 +127,12 @@ class CoreTestDb implements TestDb { public void truncateTables() { try { - truncateDatabase(getDatabase().getDataSource()); + DatabaseTestUtils.truncateAllTables(getDatabase().getDataSource()); } catch (SQLException e) { throw new IllegalStateException("Fail to truncate db tables", e); } } - private void truncateDatabase(DataSource dataSource) throws SQLException { - try (Connection connection = dataSource.getConnection()) { - connection.setAutoCommit(false); - try (Statement statement = connection.createStatement()) { - for (String table : SqTables.TABLES) { - try { - if (shouldTruncate(connection, table)) { - statement.executeUpdate(truncateSql(table)); - connection.commit(); - } - } catch (Exception e) { - connection.rollback(); - throw new IllegalStateException("Fail to truncate table " + table, e); - } - } - } - } - } - - private static boolean shouldTruncate(Connection connection, String table) { - try (Statement stmt = connection.createStatement(); - ResultSet rs = stmt.executeQuery("select count(1) from " + table)) { - if (rs.next()) { - return rs.getInt(1) > 0; - } - - } catch (SQLException ignored) { - // probably because table does not exist. That's the case with H2 tests. - } - return false; - } - - private static String truncateSql(String table) { - return "TRUNCATE TABLE " + table; - } - @Override public Database getDatabase() { return db; diff --git a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/DatabaseTestUtils.java b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/DatabaseTestUtils.java new file mode 100644 index 00000000000..4afeb5a7cd5 --- /dev/null +++ b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/DatabaseTestUtils.java @@ -0,0 +1,74 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 SonarSource SA + * mailto:info 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; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import javax.sql.DataSource; +import org.sonar.db.version.SqTables; + +/** + * Utils class for test-specific database opertations + */ +public class DatabaseTestUtils { + + private DatabaseTestUtils() { + + } + + public static void truncateAllTables(DataSource dataSource) throws SQLException { + try (Connection connection = dataSource.getConnection()) { + connection.setAutoCommit(false); + try (Statement statement = connection.createStatement()) { + for (String table : SqTables.TABLES) { + try { + if (shouldTruncate(connection, table)) { + statement.executeUpdate(truncateSql(table)); + connection.commit(); + } + } catch (Exception e) { + connection.rollback(); + throw new IllegalStateException("Fail to truncate table " + table, e); + } + } + } + } + } + + private static boolean shouldTruncate(Connection connection, String table) { + try (Statement stmt = connection.createStatement(); + ResultSet rs = stmt.executeQuery("select count(1) from " + table)) { + if (rs.next()) { + return rs.getInt(1) > 0; + } + + } catch (SQLException ignored) { + // probably because table does not exist. That's the case with H2 tests. + } + return false; + } + + private static String truncateSql(String table) { + return "TRUNCATE TABLE " + table; + } + +} diff --git a/server/sonar-db-dao/build.gradle b/server/sonar-db-dao/build.gradle index d179a2dadbf..4c3b4bc0890 100644 --- a/server/sonar-db-dao/build.gradle +++ b/server/sonar-db-dao/build.gradle @@ -40,6 +40,7 @@ dependencies { testRuntimeOnly 'org.postgresql:postgresql' testFixturesApi testFixtures(project(':server:sonar-db-core')) + testFixturesApi testFixtures(project(':server:sonar-db-migration')) testFixturesImplementation 'com.h2database:h2' diff --git a/server/sonar-db-dao/src/it/java/org/sonar/db/MyBatisIT.java b/server/sonar-db-dao/src/it/java/org/sonar/db/MyBatisIT.java index d4db5c5ceae..616d30862f6 100644 --- a/server/sonar-db-dao/src/it/java/org/sonar/db/MyBatisIT.java +++ b/server/sonar-db-dao/src/it/java/org/sonar/db/MyBatisIT.java @@ -34,7 +34,7 @@ public class MyBatisIT { @BeforeClass public static void start() { - database = SQDatabase.newH2Database("sonar2", true); + database = new SQDatabase.Builder().asH2Database("sonar2").createSchema(true).build(); database.start(); } diff --git a/server/sonar-db-dao/src/it/java/org/sonar/db/SQDatabaseForH2IT.java b/server/sonar-db-dao/src/it/java/org/sonar/db/SQDatabaseForH2IT.java index 732beddd367..8985b5d7cc3 100644 --- a/server/sonar-db-dao/src/it/java/org/sonar/db/SQDatabaseForH2IT.java +++ b/server/sonar-db-dao/src/it/java/org/sonar/db/SQDatabaseForH2IT.java @@ -29,7 +29,7 @@ import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; public class SQDatabaseForH2IT { - SQDatabase db = SQDatabase.newH2Database("sonar2", true); + SQDatabase db = new SQDatabase.Builder().asH2Database("sonar2").createSchema(true).build(); @Before public void startDb() { diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/CreateDb.java b/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/CreateDb.java index 69701ca7595..986839abd77 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/CreateDb.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/createdb/CreateDb.java @@ -24,10 +24,10 @@ import com.sonar.orchestrator.db.DatabaseClient; import com.sonar.orchestrator.db.DatabaseFactory; import com.sonar.orchestrator.db.DefaultDatabase; import java.util.function.Consumer; -import org.sonar.api.config.internal.MapSettings; -import org.sonar.api.config.internal.Settings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.sonar.api.config.internal.MapSettings; +import org.sonar.api.config.internal.Settings; import org.sonar.db.SQDatabase; public class CreateDb { @@ -37,7 +37,7 @@ public class CreateDb { Settings settings = new MapSettings(); configuration.asMap().forEach(settings::setProperty); logJdbcSettings(settings); - SQDatabase.newDatabase(settings, true).start(); + new SQDatabase.Builder().createSchema(true).withSettings(settings).build().start(); }); } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/dump/SQSchemaDumper.java b/server/sonar-db-dao/src/test/java/org/sonar/db/dump/SQSchemaDumper.java index de7f2b31f25..4a11252538b 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/dump/SQSchemaDumper.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/dump/SQSchemaDumper.java @@ -55,7 +55,8 @@ class SQSchemaDumper { }).thenComparing(String.CASE_INSENSITIVE_ORDER); String dumpToText() throws SQLException { - SQDatabase database = SQDatabase.newH2Database("SQSchemaDumper", true); + + SQDatabase database = new SQDatabase.Builder().asH2Database("SQSchemaDumper").createSchema(true).build(); database.start(); try (Connection connection = database.getDataSource().getConnection(); diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java index 874c7d26556..dc958cb32f7 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java +++ b/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java @@ -62,7 +62,7 @@ class TestDbImpl extends CoreTestDb { if (dialect != null && !"h2".equals(dialect)) { return new DefaultDatabase(new LogbackHelper(), settings); } - return SQDatabase.newH2Database("h2Tests" + DigestUtils.md5Hex(StringUtils.defaultString(schemaPath)), schemaPath == null); + return new SQDatabase.Builder().asH2Database("h2Tests" + DigestUtils.md5Hex(StringUtils.defaultString(schemaPath))).createSchema(schemaPath == null).build(); }; Consumer<Database> schemaPathExecutor = database -> { if (schemaPath == null) { diff --git a/server/sonar-db-migration/build.gradle b/server/sonar-db-migration/build.gradle index 510acdbed34..5b78862f60c 100644 --- a/server/sonar-db-migration/build.gradle +++ b/server/sonar-db-migration/build.gradle @@ -32,6 +32,7 @@ dependencies { testImplementation project(':sonar-scanner-protocol') testImplementation project(':sonar-testing-harness') testImplementation testFixtures(project(':server:sonar-db-core')) + testImplementation 'org.sonarsource.orchestrator:sonar-orchestrator-junit4' testRuntimeOnly 'com.h2database:h2' testRuntimeOnly 'com.microsoft.sqlserver:mssql-jdbc' diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsImpl.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsImpl.java index a0df9be5b13..dd4ccdd7ab4 100644 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsImpl.java +++ b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/MigrationStepsImpl.java @@ -38,7 +38,7 @@ class MigrationStepsImpl implements MigrationSteps { @Override public long getMaxMigrationNumber() { - return steps.get(steps.size() -1).getMigrationNumber(); + return steps.get(steps.size() - 1).getMigrationNumber(); } @Override diff --git a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/MakeCleanCodeAttributeColumnNotNullableInRules.java b/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/MakeCleanCodeAttributeColumnNotNullableInRules.java deleted file mode 100644 index df05a8453cc..00000000000 --- a/server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v102/MakeCleanCodeAttributeColumnNotNullableInRules.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info 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.server.platform.db.migration.version.v102; - -import java.sql.SQLException; -import org.sonar.db.Database; -import org.sonar.server.platform.db.migration.def.VarcharColumnDef; -import org.sonar.server.platform.db.migration.sql.AlterColumnsBuilder; -import org.sonar.server.platform.db.migration.step.DdlChange; - -public class MakeCleanCodeAttributeColumnNotNullableInRules extends DdlChange { - - private static final String TABLE_NAME = "rules"; - private static final String COLUMN_NAME = "clean_code_attribute"; - private static final int COLUMN_SIZE = 40; - - public MakeCleanCodeAttributeColumnNotNullableInRules(Database db) { - super(db); - } - - @Override - public void execute(Context context) throws SQLException { - VarcharColumnDef columnDef = VarcharColumnDef.newVarcharColumnDefBuilder(COLUMN_NAME) - .setColumnName(COLUMN_NAME) - .setLimit(COLUMN_SIZE) - .setIsNullable(false) - .build(); - context.execute(new AlterColumnsBuilder(getDialect(), TABLE_NAME).updateColumn(columnDef).build()); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationDbTester.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationDbTester.java new file mode 100644 index 00000000000..b6820b735e5 --- /dev/null +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationDbTester.java @@ -0,0 +1,93 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 SonarSource SA + * mailto:info 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.server.platform.db.migration; + +import com.sonar.orchestrator.config.Configuration; +import com.sonar.orchestrator.db.DatabaseClient; +import com.sonar.orchestrator.db.DatabaseFactory; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import javax.annotation.Nullable; +import org.jetbrains.annotations.NotNull; +import org.sonar.api.config.internal.Settings; +import org.sonar.db.AbstractDbTester; +import org.sonar.db.DatabaseTestUtils; +import org.sonar.server.platform.db.migration.step.MigrationStep; + +public class MigrationDbTester extends AbstractDbTester<MigrationTestDb> { + + private DatabaseClient databaseClient; + + private MigrationDbTester(@Nullable Class<? extends MigrationStep> migrationStepClass) { + super(new MigrationTestDb(migrationStepClass)); + } + + public static MigrationDbTester createEmpty() { + return new MigrationDbTester(null); + } + + public static MigrationDbTester createForMigrationStep(Class<? extends MigrationStep> migrationStepClass) { + return new MigrationDbTester(migrationStepClass); + } + + @Override + protected void before() { + db.start(); + + //Some DataChange steps might fill the tables with some data, data will be removed to ensure tests run on empty tables + truncateAllTables(); + Configuration configuration = retrieveConfiguration(); + databaseClient = DatabaseFactory.create(configuration, configuration.locators()); + } + + @NotNull + private Configuration retrieveConfiguration() { + Settings settings = db.getDatabase().getSettings(); + Configuration.Builder builder = Configuration.builder(); + settings.getProperties().forEach(builder::setProperty); + return builder.build(); + } + + @Override + protected void after() { + dropDatabase(); + db.stop(); + } + + private void dropDatabase() { + try (Connection connection = db.getDatabase().getDataSource().getConnection()) { + for (String s : databaseClient.getDropDdl()) { + PreparedStatement preparedStatement = connection.prepareStatement(s); + preparedStatement.execute(); + } + } catch (SQLException e) { + throw new RuntimeException(e); + } + } + + public void truncateAllTables() { + try { + DatabaseTestUtils.truncateAllTables(db.getDatabase().getDataSource()); + } catch (SQLException e) { + throw new IllegalStateException("Fail to truncate db tables", e); + } + } +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationTestDb.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationTestDb.java new file mode 100644 index 00000000000..a4127a195a3 --- /dev/null +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/MigrationTestDb.java @@ -0,0 +1,54 @@ +/* + * SonarQube + * Copyright (C) 2009-2023 SonarSource SA + * mailto:info 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.server.platform.db.migration; + +import javax.annotation.Nullable; +import org.sonar.db.DefaultDatabase; +import org.sonar.db.SQDatabase; +import org.sonar.db.TestDb; +import org.sonar.server.platform.db.migration.step.MigrationStep; + +public class MigrationTestDb implements TestDb { + + private final DefaultDatabase database; + + public MigrationTestDb(@Nullable Class<? extends MigrationStep> migrationStepClass) { + SQDatabase.Builder builder = new SQDatabase.Builder().asH2Database("sonar"); + if (migrationStepClass != null) { + builder.createSchema(true).untilMigrationStep(migrationStepClass); + } + database = builder.build(); + } + + @Override + public void start() { + database.start(); + } + + @Override + public void stop() { + database.stop(); + } + + @Override + public DefaultDatabase getDatabase() { + return database; + } +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/RenameVarcharColumnAbstractTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/RenameVarcharColumnAbstractTest.java index 24caeafd685..6ed9a2cfc7b 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/RenameVarcharColumnAbstractTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/RenameVarcharColumnAbstractTest.java @@ -20,16 +20,14 @@ package org.sonar.server.platform.db.migration.version; import java.sql.SQLException; -import org.junit.Rule; -import org.sonar.db.CoreDbTester; +import org.sonar.db.AbstractDbTester; +import org.sonar.db.TestDb; import org.sonar.server.platform.db.migration.step.RenameVarcharColumnChange; import static java.sql.Types.VARCHAR; public abstract class RenameVarcharColumnAbstractTest { - @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(getClass(), "schema.sql"); private final String tableName; private final String columnName; private final boolean isNullable; @@ -41,18 +39,19 @@ public abstract class RenameVarcharColumnAbstractTest { } protected void verifyMigrationIsReentrant() throws SQLException { - db.assertColumnDoesNotExist(tableName, columnName); + getDatabase().assertColumnDoesNotExist(tableName, columnName); getClassUnderTest().execute(); getClassUnderTest().execute(); - db.assertColumnDefinition(tableName, columnName, VARCHAR, 40, isNullable); + getDatabase().assertColumnDefinition(tableName, columnName, VARCHAR, 40, isNullable); } protected void verifyColumnIsRenamed() throws SQLException { - db.assertColumnDoesNotExist(tableName, columnName); + getDatabase().assertColumnDoesNotExist(tableName, columnName); getClassUnderTest().execute(); - db.assertColumnDefinition(tableName, columnName, VARCHAR, 40, isNullable); + getDatabase().assertColumnDefinition(tableName, columnName, VARCHAR, 40, isNullable); } protected abstract RenameVarcharColumnChange getClassUnderTest(); + protected abstract AbstractDbTester<? extends TestDb> getDatabase(); } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest.java index 10b4f2cb790..c0983143e22 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest.java @@ -26,14 +26,14 @@ import java.util.List; import java.util.Locale; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; public class CreateInitialSchemaTest { @Rule - public final CoreDbTester dbTester = CoreDbTester.createForSchema(CreateInitialSchemaTest.class, "empty.sql"); + public final MigrationDbTester dbTester = MigrationDbTester.createForMigrationStep(CreateInitialSchema.class); private final CreateInitialSchema underTest = new CreateInitialSchema(dbTester.database()); @@ -43,7 +43,7 @@ public class CreateInitialSchemaTest { List<String> tables = new ArrayList<>(); try (Connection connection = dbTester.openConnection(); - ResultSet rs = connection.getMetaData().getTables(null, null, null, new String[] {"TABLE"})) { + ResultSet rs = connection.getMetaData().getTables(null, null, null, new String[]{"TABLE"})) { while (rs.next()) { String schema = rs.getString("TABLE_SCHEM"); @@ -53,85 +53,87 @@ public class CreateInitialSchemaTest { } } - assertThat(tables).containsOnly( - "active_rules", - "active_rule_parameters", - "app_branch_project_branch", - "alm_pats", - "app_projects", - "alm_settings", - "audits", - "project_alm_settings", - "analysis_properties", - "ce_activity", - "ce_queue", - "ce_scanner_context", - "ce_task_characteristics", - "ce_task_input", - "ce_task_message", - "components", - "default_qprofiles", - "deprecated_rule_keys", - "duplications_index", - "es_queue", - "events", - "event_component_changes", - "file_sources", - "groups", - "groups_users", - "group_roles", - "internal_component_props", - "internal_properties", - "issues", - "issue_changes", - "live_measures", - "metrics", - "new_code_periods", - "new_code_reference_issues", - "notifications", - "org_qprofiles", - "permission_templates", - "perm_templates_groups", - "perm_templates_users", - "perm_tpl_characteristics", - "plugins", - "portfolios", - "portfolio_projects", - "portfolio_proj_branches", - "portfolio_references", - "projects", - "project_badge_token", - "project_branches", - "project_links", - "project_mappings", - "project_measures", - "project_qprofiles", - "project_qgates", - "properties", - "push_events", - "qgate_group_permissions", - "qgate_user_permissions", - "qprofile_changes", - "qprofile_edit_groups", - "qprofile_edit_users", - "quality_gates", - "quality_gate_conditions", - "rules", - "rules_parameters", - "rules_profiles", - "rule_repositories", - "rule_desc_sections", - "saml_message_ids", - "scanner_analysis_cache", - "scim_users", - "session_tokens", - "snapshots", - "users", - "user_dismissed_messages", - "user_roles", - "user_tokens", - "webhooks", - "webhook_deliveries"); + assertThat(tables) + .containsOnly( + "active_rules", + "active_rule_parameters", + "app_branch_project_branch", + "alm_pats", + "app_projects", + "alm_settings", + "audits", + "project_alm_settings", + "analysis_properties", + "ce_activity", + "ce_queue", + "ce_scanner_context", + "ce_task_characteristics", + "ce_task_input", + "ce_task_message", + "components", + "default_qprofiles", + "deprecated_rule_keys", + "duplications_index", + "es_queue", + "events", + "event_component_changes", + "file_sources", + "groups", + "groups_users", + "group_roles", + "internal_component_props", + "internal_properties", + "issues", + "issue_changes", + "live_measures", + "metrics", + "new_code_periods", + "new_code_reference_issues", + "notifications", + "org_qprofiles", + "permission_templates", + "perm_templates_groups", + "perm_templates_users", + "perm_tpl_characteristics", + "plugins", + "portfolios", + "portfolio_projects", + "portfolio_proj_branches", + "portfolio_references", + "projects", + "project_badge_token", + "project_branches", + "project_links", + "project_mappings", + "project_measures", + "project_qprofiles", + "project_qgates", + "properties", + "push_events", + "qgate_group_permissions", + "qgate_user_permissions", + "qprofile_changes", + "qprofile_edit_groups", + "qprofile_edit_users", + "quality_gates", + "quality_gate_conditions", + "rules", + "rules_parameters", + "rules_profiles", + "rule_repositories", + "rule_desc_sections", + "saml_message_ids", + "scanner_analysis_cache", + "schema_migrations", + "scim_users", + "session_tokens", + "snapshots", + "users", + "user_dismissed_messages", + "user_roles", + "user_tokens", + "webhooks", + "webhook_deliveries"); } } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/PopulateInitialSchemaTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/PopulateInitialSchemaTest.java index fb582aff7eb..f8d905650ab 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/PopulateInitialSchemaTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v00/PopulateInitialSchemaTest.java @@ -35,7 +35,7 @@ import org.sonar.api.utils.Version; import org.sonar.core.platform.SonarQubeVersion; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -52,7 +52,7 @@ public class PopulateInitialSchemaTest { private final SonarQubeVersion sonarQubeVersion = mock(SonarQubeVersion.class); @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(PopulateInitialSchemaTest.class, "v99.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateInitialSchema.class); private final PopulateInitialSchema underTest = new PopulateInitialSchema(db.database(), system2, uuidFactory, sonarQubeVersion); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/AddNclocToProjectsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/AddNclocToProjectsTest.java index c67930e4be6..0a839ac850c 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/AddNclocToProjectsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/AddNclocToProjectsTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class AddNclocToProjectsTest { @@ -32,7 +32,7 @@ public class AddNclocToProjectsTest { private static final String COLUMN_NAME = "ncloc"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AddNclocToProjectsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddNclocToProjects.class); private final DdlChange underTest = new AddNclocToProjects(db.database()); @Test @@ -51,4 +51,4 @@ public class AddNclocToProjectsTest { db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.BIGINT, null, true); } -}
\ No newline at end of file +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/CreateScimGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/CreateScimGroupsTableTest.java index 466cc51c2cf..07fe15e31cf 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/CreateScimGroupsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/CreateScimGroupsTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; @@ -31,7 +31,7 @@ import static org.sonar.server.platform.db.migration.version.v100.CreateScimGrou public class CreateScimGroupsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateScimGroupsTable.class); private final DdlChange underTest = new CreateScimGroupsTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/CreateUniqueIndexForScimGroupsUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/CreateUniqueIndexForScimGroupsUuidTest.java index fab009df53f..ba772e598b8 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/CreateUniqueIndexForScimGroupsUuidTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/CreateUniqueIndexForScimGroupsUuidTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v100; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.version.v100.CreateScimGroupsTable.TABLE_NAME; @@ -31,8 +31,7 @@ import static org.sonar.server.platform.db.migration.version.v100.CreateUniqueIn public class CreateUniqueIndexForScimGroupsUuidTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateUniqueIndexForScimGroupsUuidTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForScimGroupsUuid.class); private final DdlChange underTest = new CreateUniqueIndexForScimGroupsUuid(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidInComponentsTest.java index dbfd8b1b84b..38a6f282548 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidInComponentsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidInComponentsTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropBModuleUuidInComponentsTest { @@ -31,7 +31,7 @@ public class DropBModuleUuidInComponentsTest { private static final String COLUMN_NAME = "b_module_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropBModuleUuidInComponentsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropBModuleUuidInComponents.class); private final DdlChange underTest = new DropBModuleUuidInComponents(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidPathInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidPathInComponentsTest.java index 02bf8acebfd..b427ebd7001 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidPathInComponentsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidPathInComponentsTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropBModuleUuidPathInComponentsTest { @@ -31,7 +31,7 @@ public class DropBModuleUuidPathInComponentsTest { private static final String COLUMN_NAME = "b_module_uuid_path"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropBModuleUuidPathInComponentsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropBModuleUuidPathInComponents.class); private final DdlChange underTest = new DropBModuleUuidPathInComponents(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest.java index 9824d61eeb5..ab6e5298639 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v100; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropIndexProjectsModuleUuidInComponentsTest { @@ -31,7 +31,7 @@ public class DropIndexProjectsModuleUuidInComponentsTest { private static final String INDEX_NAME = "projects_module_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexProjectsModuleUuidInComponentsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexProjectsModuleUuidInComponents.class); private final DdlChange underTest = new DropIndexProjectsModuleUuidInComponents(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest.java index 86029dae481..a73532d3b83 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v100; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropIndexProjectsRootUuidInComponentsTest { @@ -31,7 +31,7 @@ public class DropIndexProjectsRootUuidInComponentsTest { private static final String INDEX_NAME = "projects_root_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexProjectsRootUuidInComponentsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexProjectsRootUuidInComponents.class); private final DdlChange underTest = new DropIndexProjectsRootUuidInComponents(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidInComponentsTest.java index 0fcf618690b..2c2113d2d18 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidInComponentsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidInComponentsTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropModuleUuidInComponentsTest { @@ -31,7 +31,7 @@ public class DropModuleUuidInComponentsTest { private static final String COLUMN_NAME = "module_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropModuleUuidInComponentsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropModuleUuidInComponents.class); private final DdlChange underTest = new DropModuleUuidInComponents(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidPathInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidPathInComponentsTest.java index 11be58ab2e7..f8e15302c0d 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidPathInComponentsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidPathInComponentsTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropModuleUuidPathInComponentsTest { @@ -31,7 +31,7 @@ public class DropModuleUuidPathInComponentsTest { private static final String COLUMN_NAME = "module_uuid_path"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropModuleUuidPathInComponentsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropModuleUuidPathInComponents.class); private final DdlChange underTest = new DropModuleUuidPathInComponents(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest.java index 0206bc8da58..455c0c95159 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropRootUuidInComponentsTest { @@ -31,7 +31,7 @@ public class DropRootUuidInComponentsTest { private static final String COLUMN_NAME = "root_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropRootUuidInComponentsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropRootUuidInComponents.class); private final DdlChange underTest = new DropRootUuidInComponents(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropScimUserProvisioningTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropScimUserProvisioningTest.java index cd3d1aedd75..1e47e7cab53 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropScimUserProvisioningTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropScimUserProvisioningTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v100; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -30,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class DropScimUserProvisioningTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropScimUserProvisioningTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropScimUserProvisioning.class); private final DataChange underTest = new DropScimUserProvisioning(db.database()); @Test @@ -60,4 +60,4 @@ public class DropScimUserProvisioningTest { assertThat(db.select("select * from scim_users")).isEmpty(); } -}
\ No newline at end of file +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropSonarScimEnabledPropertyTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropSonarScimEnabledPropertyTest.java index c2bba8ab347..a29226861c0 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropSonarScimEnabledPropertyTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/DropSonarScimEnabledPropertyTest.java @@ -23,13 +23,13 @@ import java.sql.SQLException; import org.assertj.core.api.Assertions; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; public class DropSonarScimEnabledPropertyTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropSonarScimEnabledPropertyTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropSonarScimEnabledProperty.class); private final DataChange underTest = new DropSonarScimEnabledProperty(db.database()); @Test @@ -51,7 +51,7 @@ public class DropSonarScimEnabledPropertyTest { Assertions.assertThat(db.select("select * from properties")).isEmpty(); } - private void insertScimProperty(CoreDbTester db) { + private void insertScimProperty(MigrationDbTester db) { db.executeInsert("properties ", "prop_key", "sonar.scim.enabled", "is_empty", false, @@ -60,4 +60,4 @@ public class DropSonarScimEnabledPropertyTest { "uuid", "some-random-uuid" ); } -}
\ No newline at end of file +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentPropertyTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentPropertyTest.java index b3a2aaa121a..ee914140e75 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentPropertyTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentPropertyTest.java @@ -25,7 +25,7 @@ import org.junit.Rule; import org.junit.Test; import org.slf4j.event.Level; import org.sonar.api.testfixtures.log.LogTester; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -37,7 +37,7 @@ public class LogMessageIfSonarScimEnabledPresentPropertyTest { public LogTester logger = new LogTester(); @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(LogMessageIfSonarScimEnabledPresentPropertyTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(LogMessageIfSonarScimEnabledPresentProperty.class); private final DataChange underTest = new LogMessageIfSonarScimEnabledPresentProperty(db.database()); @Before diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/MakeColumnUserLocalNotNullableInUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/MakeColumnUserLocalNotNullableInUsersTest.java index c6bd8d7f59f..f55ba570cee 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/MakeColumnUserLocalNotNullableInUsersTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/MakeColumnUserLocalNotNullableInUsersTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v100; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.BOOLEAN; @@ -31,8 +31,7 @@ public class MakeColumnUserLocalNotNullableInUsersTest { private static final String COLUMN_NAME = "user_local"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(MakeColumnUserLocalNotNullableInUsersTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MakeColumnUserLocalNotNullableInUsers.class); private final MakeColumnUserLocalNotNullableInUsers underTest = new MakeColumnUserLocalNotNullableInUsers(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsTest.java index 66527f7d884..c2bd919b504 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsTest.java @@ -26,7 +26,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; @@ -37,7 +37,7 @@ public class PopulateNclocForForProjectsTest { private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateNclocForForProjectsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateNclocForForProjects.class); private final DataChange underTest = new PopulateNclocForForProjects(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/RemoveOrphanRulesFromQualityProfilesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/RemoveOrphanRulesFromQualityProfilesTest.java index 5773f097fad..3576262fbb1 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/RemoveOrphanRulesFromQualityProfilesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/RemoveOrphanRulesFromQualityProfilesTest.java @@ -28,7 +28,7 @@ import org.junit.Test; import org.sonar.api.utils.System2; import org.sonar.core.util.SequenceUuidFactory; import org.sonar.core.util.UuidFactory; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -39,7 +39,7 @@ import static org.mockito.Mockito.when; public class RemoveOrphanRulesFromQualityProfilesTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(RemoveOrphanRulesFromQualityProfilesTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RemoveOrphanRulesFromQualityProfiles.class); private final System2 system2 = mock(System2.class); private final UuidFactory instance = new SequenceUuidFactory(); private final DataChange underTest = new RemoveOrphanRulesFromQualityProfiles(db.database(), instance, system2); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersTest.java index c064848c6fa..cb5206a9f51 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersTest.java @@ -26,7 +26,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic; @@ -38,7 +38,7 @@ public class UpdateUserLocalValueInUsersTest { private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); @Rule - public CoreDbTester db = CoreDbTester.createForSchema(UpdateUserLocalValueInUsersTest.class, "schema.sql"); + public MigrationDbTester db = MigrationDbTester.createForMigrationStep(UpdateUserLocalValueInUsers.class); private final DataChange underTest = new UpdateUserLocalValueInUsers(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddCodeVariantsColumnInIssuesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddCodeVariantsColumnInIssuesTableTest.java index 4d9892829cf..0bc302c5153 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddCodeVariantsColumnInIssuesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddCodeVariantsColumnInIssuesTableTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; @@ -33,8 +33,7 @@ public class AddCodeVariantsColumnInIssuesTableTest { private static final int COLUMN_SIZE = 4000; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AddCodeVariantsColumnInIssuesTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddCodeVariantsColumnInIssuesTable.class); private final AddCodeVariantsColumnInIssuesTable underTest = new AddCodeVariantsColumnInIssuesTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddIsMainColumnInProjectBranchesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddIsMainColumnInProjectBranchesTest.java index 1b4c344a769..0ea75ced646 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddIsMainColumnInProjectBranchesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddIsMainColumnInProjectBranchesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.BOOLEAN; @@ -32,8 +32,7 @@ public class AddIsMainColumnInProjectBranchesTest { private static final String COLUMN_NAME = "is_main"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AddIsMainColumnInProjectBranchesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddIsMainColumnInProjectBranches.class); private final AddIsMainColumnInProjectBranches underTest = new AddIsMainColumnInProjectBranches(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddReportSchedulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddReportSchedulesTableTest.java index f30313bc7d9..ee4148d170a 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddReportSchedulesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddReportSchedulesTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; @@ -31,7 +31,7 @@ import static org.sonar.server.platform.db.migration.version.v101.AddReportSched public class AddReportSchedulesTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddReportSchedulesTable.class); private final DdlChange underTest = new AddReportSchedulesTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddReportSubscriptionsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddReportSubscriptionsTableTest.java index a46820299fb..cd86d73e298 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddReportSubscriptionsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AddReportSubscriptionsTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; @@ -31,7 +31,7 @@ import static org.sonar.server.platform.db.migration.version.v101.AddReportSubsc public class AddReportSubscriptionsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddReportSubscriptionsTable.class); private final DdlChange underTest = new AddReportSubscriptionsTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AlterIsMainColumnInProjectBranchesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AlterIsMainColumnInProjectBranchesTest.java index a96600f0f95..a4253a031ba 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AlterIsMainColumnInProjectBranchesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/AlterIsMainColumnInProjectBranchesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.BOOLEAN; @@ -32,8 +32,7 @@ public class AlterIsMainColumnInProjectBranchesTest { private static final String COLUMN_NAME = "is_main"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AlterIsMainColumnInProjectBranchesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AlterIsMainColumnInProjectBranches.class); private final AlterIsMainColumnInProjectBranches underTest = new AlterIsMainColumnInProjectBranches(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateExternalGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateExternalGroupsTableTest.java index 04d3a88bb96..bc868716cef 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateExternalGroupsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateExternalGroupsTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; @@ -35,7 +35,7 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateExternal public class CreateExternalGroupsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateExternalGroupsTable.class); private final DdlChange createExternalGroupsTable = new CreateExternalGroupsTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForEmailOnUsersTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForEmailOnUsersTableTest.java index 012def57f09..4b2e3db3083 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForEmailOnUsersTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForEmailOnUsersTableTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.sonar.server.platform.db.migration.version.v101.CreateIndexForEmailOnUsersTable.COLUMN_NAME; import static org.sonar.server.platform.db.migration.version.v101.CreateIndexForEmailOnUsersTable.INDEX_NAME; @@ -30,8 +30,7 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateIndexFor public class CreateIndexForEmailOnUsersTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexForEmailOnUsersTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexForEmailOnUsersTable.class); private final CreateIndexForEmailOnUsersTable createIndexForEmailOnUsersTable = new CreateIndexForEmailOnUsersTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForScmAccountOnScmAccountsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForScmAccountOnScmAccountsTableTest.java index bd5e840aafc..1267531a572 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForScmAccountOnScmAccountsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForScmAccountOnScmAccountsTableTest.java @@ -22,16 +22,15 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.sonar.server.platform.db.migration.version.v101.CreateIndexForScmAccountOnScmAccountsTable.INDEX_NAME; -import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNT_COLUMN_NAME; import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNTS_TABLE_NAME; +import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNT_COLUMN_NAME; public class CreateIndexForScmAccountOnScmAccountsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexForScmAccountOnScmAccountsTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexForScmAccountOnScmAccountsTable.class); private final CreateIndexForScmAccountOnScmAccountsTable createIndexForScmAccountOnScmAccountsTable = new CreateIndexForScmAccountOnScmAccountsTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableTest.java index 68d7e75ba56..8c0155f41f7 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.sonar.server.platform.db.migration.version.v101.CreateExternalGroupsTable.EXTERNAL_GROUP_ID_COLUMN_NAME; import static org.sonar.server.platform.db.migration.version.v101.CreateExternalGroupsTable.EXTERNAL_IDENTITY_PROVIDER_COLUMN_NAME; @@ -32,8 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateIndexOnE public class CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexOnExternalIdAndIdentityOnExternalGroupsTable.class); private final CreateIndexOnExternalIdAndIdentityOnExternalGroupsTable createIndexOnExternalIdAndIdentityOnExternalGroupsTable = new CreateIndexOnExternalIdAndIdentityOnExternalGroupsTable( db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateProjectUuidInUserTokensTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateProjectUuidInUserTokensTest.java index b626159e228..708bae745e0 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateProjectUuidInUserTokensTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateProjectUuidInUserTokensTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; @@ -31,8 +31,7 @@ public class CreateProjectUuidInUserTokensTest { private static final String COLUMN_NAME = "project_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateProjectUuidInUserTokensTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateProjectUuidInUserTokens.class); private final CreateProjectUuidInUserTokens underTest = new CreateProjectUuidInUserTokens(db.database()); @Test @@ -49,4 +48,4 @@ public class CreateProjectUuidInUserTokensTest { underTest.execute(); db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 40, null); } -}
\ No newline at end of file +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateScmAccountsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateScmAccountsTableTest.java index 1caa1642c66..e3b27e8b085 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateScmAccountsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateScmAccountsTableTest.java @@ -23,18 +23,18 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.USER_UUID_SIZE; +import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNTS_TABLE_NAME; import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNT_COLUMN_NAME; import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNT_SIZE; -import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNTS_TABLE_NAME; import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.USER_UUID_COLUMN_NAME; public class CreateScmAccountsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateScmAccountsTable.class); private final DdlChange createScmAccountsTable = new CreateScmAccountsTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSchedulesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSchedulesTableTest.java index 824e7a5eaf3..a3f1427a561 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSchedulesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSchedulesTableTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.sonar.server.platform.db.migration.version.v101.AddReportSchedulesTable.TABLE_NAME; import static org.sonar.server.platform.db.migration.version.v101.CreateUniqueIndexForReportSchedulesTable.COLUMN_NAME_BRANCH; @@ -32,8 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateUniqueIn public class CreateUniqueIndexForReportSchedulesTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateUniqueIndexForReportSchedulesTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForReportSchedulesTable.class); private final CreateUniqueIndexForReportSchedulesTable createUniqueIndexForReportSchedulesTable = new CreateUniqueIndexForReportSchedulesTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSubscriptionsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSubscriptionsTableTest.java index 63fe45fac0a..50bd0ba9f77 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSubscriptionsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSubscriptionsTableTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.sonar.server.platform.db.migration.version.v101.AddReportSubscriptionsTable.TABLE_NAME; import static org.sonar.server.platform.db.migration.version.v101.CreateUniqueIndexForReportSubscriptionsTable.COLUMN_NAME_BRANCH; @@ -33,8 +33,7 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateUniqueIn public class CreateUniqueIndexForReportSubscriptionsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateUniqueIndexForReportSubscriptionsTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForReportSubscriptionsTable.class); private final CreateUniqueIndexForReportSubscriptionsTable createUniqueIndexForReportSubscriptionsTable = new CreateUniqueIndexForReportSubscriptionsTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/DropProjectKeyInUserTokensTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/DropProjectKeyInUserTokensTest.java index f3b5f8a3011..8d59ce27dce 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/DropProjectKeyInUserTokensTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/DropProjectKeyInUserTokensTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.version.v101.DropProjectKeyInUserTokens.COLUMN_NAME; @@ -31,7 +31,7 @@ import static org.sonar.server.platform.db.migration.version.v101.DropProjectKey public class DropProjectKeyInUserTokensTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropProjectKeyInUserTokensTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropProjectKeyInUserTokens.class); private final DdlChange underTest = new DropProjectKeyInUserTokens(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/DropScmAccountsInUsersTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/DropScmAccountsInUsersTest.java index 7770afbb5d3..9758140ef62 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/DropScmAccountsInUsersTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/DropScmAccountsInUsersTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.version.v101.DropScmAccountsInUsers.COLUMN_NAME; @@ -32,7 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v101.DropScmAccount public class DropScmAccountsInUsersTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropScmAccountsInUsersTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropScmAccountsInUsers.class); private final DdlChange dropScmAccountsInUsers = new DropScmAccountsInUsers(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/FixDifferentUuidsForSubportfoliosTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/FixDifferentUuidsForSubportfoliosTest.java index d114249b725..d45c4e1f3d7 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/FixDifferentUuidsForSubportfoliosTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/FixDifferentUuidsForSubportfoliosTest.java @@ -28,7 +28,7 @@ import org.assertj.core.api.Assertions; import org.junit.Rule; import org.junit.Test; import org.sonar.api.resources.Qualifiers; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.util.stream.Collectors.toSet; @@ -40,8 +40,7 @@ public class FixDifferentUuidsForSubportfoliosTest { private static final String NEW_CHILD_SUBPF_UUID = "childsubpfUuid"; private static final String OLD_CHILD_SUBPF_UUID = "old_child_subpf_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(FixDifferentUuidsForSubportfoliosTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(FixDifferentUuidsForSubportfolios.class); private final FixDifferentUuidsForSubportfolios underTest = new FixDifferentUuidsForSubportfolios(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseKeeColumnSizeInInternalPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseKeeColumnSizeInInternalPropertiesTest.java index 914393148c8..a6b19ca9bf4 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseKeeColumnSizeInInternalPropertiesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseKeeColumnSizeInInternalPropertiesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; import static org.sonar.server.platform.db.migration.version.v101.IncreaseKeeColumnSizeInInternalProperties.COLUMN_NAME; @@ -32,8 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v101.IncreaseKeeCol public class IncreaseKeeColumnSizeInInternalPropertiesTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(IncreaseKeeColumnSizeInInternalPropertiesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseKeeColumnSizeInInternalProperties.class); private final IncreaseKeeColumnSizeInInternalProperties underTest = new IncreaseKeeColumnSizeInInternalProperties(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeActivityTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeActivityTest.java index 3dbde9603d9..50157370c6b 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeActivityTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeActivityTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTypeColumnSizeInCeActivity.COLUMN_NAME; @@ -32,8 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTy public class IncreaseTaskTypeColumnSizeInCeActivityTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(IncreaseTaskTypeColumnSizeInCeActivityTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseTaskTypeColumnSizeInCeActivity.class); private final IncreaseTaskTypeColumnSizeInCeActivity underTest = new IncreaseTaskTypeColumnSizeInCeActivity(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeQueueTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeQueueTest.java index ea718a32f70..9a6f4c3c70e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeQueueTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeQueueTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTypeColumnSizeInCeQueue.COLUMN_NAME; @@ -32,8 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTy public class IncreaseTaskTypeColumnSizeInCeQueueTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(IncreaseTaskTypeColumnSizeInCeQueueTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseTaskTypeColumnSizeInCeQueue.class); private final IncreaseTaskTypeColumnSizeInCeQueue underTest = new IncreaseTaskTypeColumnSizeInCeQueue(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/MigrateScmAccountsFromUsersToScmAccountsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/MigrateScmAccountsFromUsersToScmAccountsTest.java index 93763ceea72..253caba1d1f 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/MigrateScmAccountsFromUsersToScmAccountsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/MigrateScmAccountsFromUsersToScmAccountsTest.java @@ -29,7 +29,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import org.sonar.server.platform.db.migration.version.v101.MigrateScmAccountsFromUsersToScmAccounts.ScmAccountRow; @@ -47,8 +47,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsTest { private static final String SCM_ACCOUNT_CAMELCASE = "scmAccount3"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(MigrateScmAccountsFromUsersToScmAccountsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MigrateScmAccountsFromUsersToScmAccounts.class); private final DataChange migrateScmAccountsFromUsersToScmAccounts = new MigrateScmAccountsFromUsersToScmAccounts(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateProjectUuidInUserTokensTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateProjectUuidInUserTokensTest.java index d8282182157..e3de132093a 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateProjectUuidInUserTokensTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateProjectUuidInUserTokensTest.java @@ -27,7 +27,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -37,7 +37,7 @@ public class PopulateProjectUuidInUserTokensTest { private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateProjectUuidInUserTokensTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateProjectUuidInUserTokens.class); private final DataChange underTest = new PopulateProjectUuidInUserTokens(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedulesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedulesTest.java index fbef1a73532..0783dfbec2d 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedulesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedulesTest.java @@ -24,7 +24,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.tuple; public class PopulateReportSchedulesTest { @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateReportSchedulesTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateReportSchedules.class); private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); private final DataChange underTest = new PopulateReportSchedules(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptionsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptionsTest.java index ba63b0649d5..1216f04ec5c 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptionsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptionsTest.java @@ -24,7 +24,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.tuple; public class PopulateReportSubscriptionsTest { @Rule - public CoreDbTester db = CoreDbTester.createForSchema(PopulateReportSubscriptionsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateReportSubscriptions.class); private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); private final DataChange underTest = new PopulateReportSubscriptions(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RemoveOrphanUserTokensTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RemoveOrphanUserTokensTest.java index be11ab3ff84..d1e4f335862 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RemoveOrphanUserTokensTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RemoveOrphanUserTokensTest.java @@ -27,7 +27,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -36,7 +36,7 @@ public class RemoveOrphanUserTokensTest { private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); @Rule - public CoreDbTester db = CoreDbTester.createForSchema(RemoveOrphanUserTokensTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RemoveOrphanUserTokens.class); private final DataChange underTest = new RemoveOrphanUserTokens(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RemoveReportPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RemoveReportPropertiesTest.java index 7fde5d33706..efa656ea371 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RemoveReportPropertiesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RemoveReportPropertiesTest.java @@ -24,7 +24,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -36,7 +36,7 @@ public class RemoveReportPropertiesTest { private static final String SONAR_GOVERNANCE_REPORT_LAST_SEND_TIME_IN_MS = "sonar.governance.report.lastSendTimeInMs"; private static final String SONAR_GOVERNANCE_REPORT_PROJECT_BRANCH_LAST_SEND_TIME_IN_MS = "sonar.governance.report.project.branch.lastSendTimeInMs"; @Rule - public CoreDbTester db = CoreDbTester.createForSchema(RemoveReportPropertiesTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RemoveReportProperties.class); private final DataChange underTest = new RemoveReportProperties(db.database()); @@ -74,7 +74,7 @@ public class RemoveReportPropertiesTest { "is_empty", false, "text_value", value, "created_at", 1000, - "component_uuid", componentUuid, + "entity_uuid", componentUuid, "user_uuid", userUuid ); } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RenameColumnComponentUuidInPropertiesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RenameColumnComponentUuidInPropertiesTest.java index 5205beeea10..ea3d4c0cb40 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RenameColumnComponentUuidInPropertiesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/RenameColumnComponentUuidInPropertiesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v101; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; @@ -32,8 +32,7 @@ public class RenameColumnComponentUuidInPropertiesTest { public static final String NEW_COLUMN_NAME = "entity_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(RenameColumnComponentUuidInPropertiesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameColumnComponentUuidInProperties.class); private final RenameColumnComponentUuidInProperties underTest = new RenameColumnComponentUuidInProperties(db.database()); @Test @@ -50,4 +49,4 @@ public class RenameColumnComponentUuidInPropertiesTest { underTest.execute(); db.assertColumnDefinition(TABLE_NAME, NEW_COLUMN_NAME, VARCHAR, 40, true); } -}
\ No newline at end of file +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/UpdateIsMainColumnInProjectBranchesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/UpdateIsMainColumnInProjectBranchesTest.java index 72bd023d928..d265a4dfd8e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/UpdateIsMainColumnInProjectBranchesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v101/UpdateIsMainColumnInProjectBranchesTest.java @@ -26,7 +26,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.UuidFactory; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -36,7 +36,7 @@ public class UpdateIsMainColumnInProjectBranchesTest { private final UuidFactory uuidFactory = UuidFactoryFast.getInstance(); @Rule - public CoreDbTester db = CoreDbTester.createForSchema(UpdateIsMainColumnInProjectBranchesTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(UpdateIsMainColumnInProjectBranches.class); private final DataChange underTest = new UpdateIsMainColumnInProjectBranches(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddCleanCodeAttributeInRulesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddCleanCodeAttributeInRulesTest.java index f77c5109c07..d5f21f1e094 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddCleanCodeAttributeInRulesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddCleanCodeAttributeInRulesTest.java @@ -23,14 +23,14 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; public class AddCleanCodeAttributeInRulesTest { private static final String TABLE_NAME = "rules"; private static final String COLUMN_NAME = "clean_code_attribute"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AddCleanCodeAttributeInRulesTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddCleanCodeAttributeInRules.class); private final AddCleanCodeAttributeInRules underTest = new AddCleanCodeAttributeInRules(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddUserConsentRequiredIfGithubAutoProvisioningEnabledTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddUserConsentRequiredIfGithubAutoProvisioningEnabledTest.java index 06ea3d24998..3e8ec137f6d 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddUserConsentRequiredIfGithubAutoProvisioningEnabledTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/AddUserConsentRequiredIfGithubAutoProvisioningEnabledTest.java @@ -27,7 +27,7 @@ import org.slf4j.event.Level; import org.sonar.api.testfixtures.log.LogTester; import org.sonar.api.utils.System2; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -40,8 +40,7 @@ public class AddUserConsentRequiredIfGithubAutoProvisioningEnabledTest { public LogTester logger = new LogTester(); @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AddUserConsentRequiredIfGithubAutoProvisioningEnabledTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddUserConsentRequiredIfGithubAutoProvisioningEnabled.class); private final DataChange underTest = new AddUserConsentRequiredIfGithubAutoProvisioningEnabled(db.database(), new System2(), UuidFactoryFast.getInstance()); @Before diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateAnticipatedTransitionsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateAnticipatedTransitionsTableTest.java index b38e90b6208..b037366fbc2 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateAnticipatedTransitionsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateAnticipatedTransitionsTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.MAX_SIZE; @@ -33,7 +33,7 @@ import static org.sonar.server.platform.db.migration.version.v102.CreateAnticipa public class CreateAnticipatedTransitionsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateAnticipatedTransitionsTable.class); private final DdlChange createAnticipatedTransitionsTable = new CreateAnticipatedTransitionsTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateBooleanPurgedColumnInSnapshotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateBooleanPurgedColumnInSnapshotsTest.java index 952a6bd6909..23ceb1e75aa 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateBooleanPurgedColumnInSnapshotsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateBooleanPurgedColumnInSnapshotsTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.BOOLEAN; @@ -32,7 +32,7 @@ public class CreateBooleanPurgedColumnInSnapshotsTest { private static final String COLUMN_NAME = "purged"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateBooleanPurgedColumnInSnapshotsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateBooleanPurgedColumnInSnapshots.class); private final CreateBooleanPurgedColumnInSnapshots underTest = new CreateBooleanPurgedColumnInSnapshots(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateGithubOrganizationsGroupsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateGithubOrganizationsGroupsTableTest.java index e4e900d43c7..45598505114 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateGithubOrganizationsGroupsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateGithubOrganizationsGroupsTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; @@ -33,8 +33,7 @@ import static org.sonar.server.platform.db.migration.version.v102.CreateGithubOr public class CreateGithubOrganizationsGroupsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateGithubOrganizationsGroupsTable.class); private final DdlChange createGithubOrganizationsGroupsTable = new CreateGithubOrganizationsGroupsTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexCreatedAtInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexCreatedAtInWebhookDeliveriesTest.java index 2a62cf35bf3..4b308af433c 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexCreatedAtInWebhookDeliveriesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexCreatedAtInWebhookDeliveriesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class CreateIndexCreatedAtInWebhookDeliveriesTest { @@ -31,8 +31,7 @@ public class CreateIndexCreatedAtInWebhookDeliveriesTest { public static final String INDEX_NAME = "wd_created_at"; public static final String EXPECTED_COLUMN = "created_at"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexCreatedAtInWebhookDeliveriesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexCreatedAtInWebhookDeliveries.class); private final DdlChange createIndex = new CreateIndexCreatedAtInWebhookDeliveries(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeActivityTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeActivityTest.java index dde2a931208..7707c5034f9 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeActivityTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeActivityTest.java @@ -22,12 +22,11 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; public class CreateIndexEntityUuidInCeActivityTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexEntityUuidInCeActivityTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexEntityUuidInCeActivity.class); private final CreateIndexEntityUuidInCeActivity createIndex = new CreateIndexEntityUuidInCeActivity(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeQueueTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeQueueTest.java index 01e735560cb..e48777c1b60 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeQueueTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeQueueTest.java @@ -22,12 +22,11 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; public class CreateIndexEntityUuidInCeQueueTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexEntityUuidInCeQueueTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexEntityUuidInCeQueue.class); private final CreateIndexEntityUuidInCeQueue createIndex = new CreateIndexEntityUuidInCeQueue(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInGroupRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInGroupRolesTest.java index b637bb323ec..ef2cbfa0689 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInGroupRolesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInGroupRolesTest.java @@ -22,12 +22,11 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; public class CreateIndexEntityUuidInGroupRolesTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexEntityUuidInGroupRolesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexEntityUuidInGroupRoles.class); private final CreateIndexEntityUuidInGroupRoles createIndex = new CreateIndexEntityUuidInGroupRoles(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInUserRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInUserRolesTest.java index ed65c024327..7a023cf5098 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInUserRolesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInUserRolesTest.java @@ -22,12 +22,11 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; public class CreateIndexEntityUuidInUserRolesTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexEntityUuidInUserRolesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexEntityUuidInUserRoles.class); private final CreateIndexEntityUuidInUserRoles createIndex = new CreateIndexEntityUuidInUserRoles(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest.java index 364adb2b55c..919d25df659 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest { @@ -31,8 +31,7 @@ public class CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest { public static final String INDEX_NAME = "wd_project_uuid_created_at"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexProjectUuidCreatedAtInWebhookDeliveries.class); private final DdlChange createIndex = new CreateIndexProjectUuidCreatedAtInWebhookDeliveries(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInProjectBranchesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInProjectBranchesTest.java index bb8a50d25ca..b5682394e8c 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInProjectBranchesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInProjectBranchesTest.java @@ -22,12 +22,13 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class CreateIndexProjectUuidInProjectBranchesTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexProjectUuidInProjectBranchesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexProjectUuidInProjectBranches.class); private final CreateIndexProjectUuidInProjectBranches createIndex = new CreateIndexProjectUuidInProjectBranches(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexRootComponentUuidInSnapshotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexRootComponentUuidInSnapshotsTest.java index 18df8a97a16..851addf81a3 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexRootComponentUuidInSnapshotsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexRootComponentUuidInSnapshotsTest.java @@ -22,12 +22,13 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class CreateIndexRootComponentUuidInSnapshotsTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexRootComponentUuidInSnapshotsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexRootComponentUuidInSnapshots.class); private final CreateIndexRootComponentUuidInSnapshots createIndex = new CreateIndexRootComponentUuidInSnapshots(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest.java index 796553e15b5..436dcc0fa5b 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest { @@ -31,8 +31,7 @@ public class CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest { public static final String INDEX_NAME = "wd_ce_task_uuid_created_at"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexTaskUuidCreatedAtInWebhookDeliveries.class); private final DdlChange createIndex = new CreateIndexTaskUuidCreatedAtInWebhookDeliveries(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest.java index 9ed15a21aac..1bea69bc2a2 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest { @@ -31,8 +31,7 @@ public class CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest { public static final String INDEX_NAME = "wd_webhook_uuid_created_at"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexWebhookUuidCreatedAtInWebhookDeliveries.class); private final DdlChange createIndex = new CreateIndexWebhookUuidCreatedAtInWebhookDeliveries(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIssueImpactsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIssueImpactsTableTest.java index ce093c98976..29b55c63d3a 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIssueImpactsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateIssueImpactsTableTest.java @@ -23,14 +23,14 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class CreateIssueImpactsTableTest { private static final String EXPECTED_TABLE_NAME = "issues_impacts"; @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIssueImpactsTable.class); private final DdlChange underTest = new CreateIssueImpactsTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreatePreviousNonCompliantValueInNewCodePeriodsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreatePreviousNonCompliantValueInNewCodePeriodsTest.java index cc3f952ce74..a0be5de46fb 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreatePreviousNonCompliantValueInNewCodePeriodsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreatePreviousNonCompliantValueInNewCodePeriodsTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; @@ -33,8 +33,7 @@ public class CreatePreviousNonCompliantValueInNewCodePeriodsTest { private static final String TABLE_NAME = "new_code_periods"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreatePreviousNonCompliantValueInNewCodePeriodsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreatePreviousNonCompliantValueInNewCodePeriods.class); private final CreatePreviousNonCompliantValueInNewCodePeriods underTest = new CreatePreviousNonCompliantValueInNewCodePeriods(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateRulesDefaultImpactsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateRulesDefaultImpactsTableTest.java index 3b7f93c582d..8226fe7eb7e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateRulesDefaultImpactsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateRulesDefaultImpactsTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; @@ -31,7 +31,7 @@ public class CreateRulesDefaultImpactsTableTest { private static final String EXPECTED_TABLE_NAME = "rules_default_impacts"; @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateRulesDefaultImpactsTable.class); private final DdlChange underTest = new CreateRulesDefaultImpactsTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnIssuesImpactsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnIssuesImpactsTest.java index 2e143577715..af6f26312c6 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnIssuesImpactsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnIssuesImpactsTest.java @@ -22,12 +22,13 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class CreateUniqueConstraintOnIssuesImpactsTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateUniqueConstraintOnIssuesImpactsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueConstraintOnIssuesImpacts.class); private final CreateUniqueConstraintOnIssuesImpacts underTest = new CreateUniqueConstraintOnIssuesImpacts(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnRulesDefaultImpactsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnRulesDefaultImpactsTest.java index aed10eb8baa..de5fe0beb74 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnRulesDefaultImpactsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnRulesDefaultImpactsTest.java @@ -22,13 +22,14 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class CreateUniqueConstraintOnRulesDefaultImpactsTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateUniqueConstraintOnRulesDefaultImpactsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueConstraintOnRulesDefaultImpacts.class); private final CreateUniqueConstraintOnRulesDefaultImpacts underTest = new CreateUniqueConstraintOnRulesDefaultImpacts(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInGroupRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInGroupRolesTest.java index 64441a5a19b..869cd74f616 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInGroupRolesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInGroupRolesTest.java @@ -23,6 +23,9 @@ import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class DropIndexComponentUuidInGroupRolesTest { @@ -30,9 +33,12 @@ public class DropIndexComponentUuidInGroupRolesTest { private static final String COLUMN_NAME = "component_uuid"; private static final String INDEX_NAME = "group_roles_component_uuid"; + /** + * {@link MigrationDbTester} is not used because we are expecting index with component_uuid to exist. However, renaming the column component_uuid to entity_uuid + * also updated the index + */ @Rule public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexComponentUuidInGroupRolesTest.class, "schema.sql"); - private final DropIndexComponentUuidInGroupRoles underTest = new DropIndexComponentUuidInGroupRoles(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInSnapshotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInSnapshotsTest.java index 7329d5c3ff4..7e3590efc8e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInSnapshotsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInSnapshotsTest.java @@ -22,7 +22,9 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class DropIndexComponentUuidInSnapshotsTest { @@ -31,8 +33,7 @@ public class DropIndexComponentUuidInSnapshotsTest { private static final String INDEX_NAME = "snapshot_component"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexComponentUuidInSnapshotsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexComponentUuidInSnapshots.class); private final DropIndexComponentUuidInSnapshots underTest = new DropIndexComponentUuidInSnapshots(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInUserRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInUserRolesTest.java index 65fe916469a..417eb1d2005 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInUserRolesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInUserRolesTest.java @@ -23,6 +23,9 @@ import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class DropIndexComponentUuidInUserRolesTest { @@ -30,9 +33,12 @@ public class DropIndexComponentUuidInUserRolesTest { private static final String COLUMN_NAME = "component_uuid"; private static final String INDEX_NAME = "user_roles_component_uuid"; + /** + * {@link MigrationDbTester} is not used because we are expecting index with component_uuid to exist. However, renaming the column component_uuid to entity_uuid + * also updated the index + */ @Rule public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexComponentUuidInUserRolesTest.class, "schema.sql"); - private final DropIndexComponentUuidInUserRoles underTest = new DropIndexComponentUuidInUserRoles(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInWebhookDeliveriesTest.java index 2d1428bbbe4..995782ba52e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInWebhookDeliveriesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInWebhookDeliveriesTest.java @@ -22,7 +22,9 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class DropIndexComponentUuidInWebhookDeliveriesTest { @@ -31,8 +33,7 @@ public class DropIndexComponentUuidInWebhookDeliveriesTest { private static final String INDEX_NAME = "component_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexComponentUuidInWebhookDeliveriesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexComponentUuidInWebhookDeliveries.class); private final DropIndexComponentUuidInWebhookDeliveries underTest = new DropIndexComponentUuidInWebhookDeliveries(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeActivityTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeActivityTest.java index 86dec5551bf..7695b874002 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeActivityTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeActivityTest.java @@ -22,7 +22,9 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class DropIndexMainComponentUuidInCeActivityTest { @@ -31,8 +33,7 @@ public class DropIndexMainComponentUuidInCeActivityTest { private static final String INDEX_NAME = "ce_activity_main_component"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexMainComponentUuidInCeActivityTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexMainComponentUuidInCeActivity.class); private final DropIndexMainComponentUuidInCeActivity underTest = new DropIndexMainComponentUuidInCeActivity(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeQueueTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeQueueTest.java index 2b4c34baa04..0d1bb2ada7e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeQueueTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeQueueTest.java @@ -22,7 +22,9 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class DropIndexMainComponentUuidInCeQueueTest { @@ -31,8 +33,7 @@ public class DropIndexMainComponentUuidInCeQueueTest { private static final String INDEX_NAME = "ce_queue_main_component"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexMainComponentUuidInCeQueueTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexMainComponentUuidInCeQueue.class); private final DropIndexMainComponentUuidInCeQueue underTest = new DropIndexMainComponentUuidInCeQueue(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexOnMainBranchProjectUuidTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexOnMainBranchProjectUuidTest.java index 8a46809324c..855d2a79b97 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexOnMainBranchProjectUuidTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexOnMainBranchProjectUuidTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropIndexOnMainBranchProjectUuidTest { @@ -31,7 +31,7 @@ public class DropIndexOnMainBranchProjectUuidTest { private static final String INDEX_NAME = "idx_main_branch_prj_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexOnMainBranchProjectUuidTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexOnMainBranchProjectUuid.class); private final DdlChange underTest = new DropIndexOnMainBranchProjectUuid(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexProjectUuidInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexProjectUuidInWebhookDeliveriesTest.java index a4202a38ea1..35d031b8022 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexProjectUuidInWebhookDeliveriesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexProjectUuidInWebhookDeliveriesTest.java @@ -23,6 +23,7 @@ import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropIndexProjectUuidInWebhookDeliveriesTest { @@ -31,9 +32,12 @@ public class DropIndexProjectUuidInWebhookDeliveriesTest { private static final String COLUMN_NAME = "project_uuid"; private static final String INDEX_NAME = "wd_project_uuid"; + /** + * {@link MigrationDbTester} is not used because we are expecting index with component_uuid to exist. However, renaming the column component_uuid to entity_uuid + * also updated the index + */ @Rule public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexProjectUuidInWebhookDeliveriesTest.class, "schema.sql"); - private final DdlChange underTest = new DropIndexProjectUuidInWebhookDeliveries(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexTaskUuidInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexTaskUuidInWebhookDeliveriesTest.java index 89522753c92..c42c97cc9d7 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexTaskUuidInWebhookDeliveriesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexTaskUuidInWebhookDeliveriesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropIndexTaskUuidInWebhookDeliveriesTest { @@ -32,8 +32,7 @@ public class DropIndexTaskUuidInWebhookDeliveriesTest { private static final String INDEX_NAME = "ce_task_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexTaskUuidInWebhookDeliveriesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexTaskUuidInWebhookDeliveries.class); private final DdlChange underTest = new DropIndexTaskUuidInWebhookDeliveries(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexWebhookUuidInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexWebhookUuidInWebhookDeliveriesTest.java index 6a9d13023f2..fc66cded4b0 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexWebhookUuidInWebhookDeliveriesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropIndexWebhookUuidInWebhookDeliveriesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; public class DropIndexWebhookUuidInWebhookDeliveriesTest { @@ -32,8 +32,7 @@ public class DropIndexWebhookUuidInWebhookDeliveriesTest { private static final String INDEX_NAME = "idx_wbhk_dlvrs_wbhk_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexWebhookUuidInWebhookDeliveriesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexWebhookUuidInWebhookDeliveries.class); private final DdlChange underTest = new DropIndexWebhookUuidInWebhookDeliveries(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropMainBranchProjectUuidInComponentsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropMainBranchProjectUuidInComponentsTest.java index f02681814dc..bd06d1ed3b3 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropMainBranchProjectUuidInComponentsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropMainBranchProjectUuidInComponentsTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.version.v102.DropMainBranchProjectUuidInComponents.COLUMN_NAME; @@ -32,7 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v102.DropMainBranch public class DropMainBranchProjectUuidInComponentsTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropMainBranchProjectUuidInComponentsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropMainBranchProjectUuidInComponents.class); private final DdlChange underTest = new DropMainBranchProjectUuidInComponents(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropPurgeStatusColumnInSnapshotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropPurgeStatusColumnInSnapshotsTest.java index cceeff1809b..b48b0b2bfa1 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropPurgeStatusColumnInSnapshotsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropPurgeStatusColumnInSnapshotsTest.java @@ -23,7 +23,9 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class DropPurgeStatusColumnInSnapshotsTest { @@ -31,8 +33,7 @@ public class DropPurgeStatusColumnInSnapshotsTest { private static final String COLUMN_NAME = "purge_status"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropPurgeStatusColumnInSnapshotsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropPurgeStatusColumnInSnapshots.class); private final DropPurgeStatusColumnInSnapshots underTest = new DropPurgeStatusColumnInSnapshots(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropTableProjectMappingsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropTableProjectMappingsTest.java index 75c58e4c3ef..54e9f4da91e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropTableProjectMappingsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/DropTableProjectMappingsTest.java @@ -22,14 +22,15 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class DropTableProjectMappingsTest { public static final String TABLE_NAME = "project_mappings"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DropTableProjectMappingsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropTableProjectMappings.class); private final DropTableProjectMappings underTest = new DropTableProjectMappings(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/FixSqaleIndexMetricDescriptionTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/FixSqaleIndexMetricDescriptionTest.java index b0034b37044..9565362d84d 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/FixSqaleIndexMetricDescriptionTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/FixSqaleIndexMetricDescriptionTest.java @@ -23,15 +23,14 @@ import java.sql.SQLException; import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; public class FixSqaleIndexMetricDescriptionTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(FixSqaleIndexMetricDescriptionTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(FixSqaleIndexMetricDescription.class); private final FixSqaleIndexMetricDescription underTest = new FixSqaleIndexMetricDescription(db.database()); private final String OLD_DESCRIPTION = "Total effort (in hours) to fix all the issues on the component and therefore to comply to all the requirements."; private final String NEW_DESCRIPTION = "Total effort (in minutes) to fix all the issues on the component and therefore to comply to all the requirements."; diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/IncreaseIsLastKeyInCeActivityTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/IncreaseIsLastKeyInCeActivityTest.java index 9df7f4dc744..5e999cff16e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/IncreaseIsLastKeyInCeActivityTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/IncreaseIsLastKeyInCeActivityTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; import static org.sonar.server.platform.db.migration.version.v102.IncreaseIsLastKeyInCeActivity.COLUMN_NAME; @@ -32,8 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v102.IncreaseIsLast public class IncreaseIsLastKeyInCeActivityTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(IncreaseIsLastKeyInCeActivityTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseIsLastKeyInCeActivity.class); private final IncreaseIsLastKeyInCeActivity underTest = new IncreaseIsLastKeyInCeActivity(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/IncreaseMainIsLastKeyInCeActivityTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/IncreaseMainIsLastKeyInCeActivityTest.java index 270fdd92a37..cb3fa740746 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/IncreaseMainIsLastKeyInCeActivityTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/IncreaseMainIsLastKeyInCeActivityTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; import static org.sonar.server.platform.db.migration.version.v102.IncreaseMainIsLastKeyInCeActivity.COLUMN_NAME; @@ -32,8 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v102.IncreaseMainIs public class IncreaseMainIsLastKeyInCeActivityTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(IncreaseMainIsLastKeyInCeActivityTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseMainIsLastKeyInCeActivity.class); private final IncreaseMainIsLastKeyInCeActivity underTest = new IncreaseMainIsLastKeyInCeActivity(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakeCleanCodeAttributeColumnNotNullableInRulesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakeCleanCodeAttributeColumnNotNullableInRulesTest.java deleted file mode 100644 index d29dae44376..00000000000 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakeCleanCodeAttributeColumnNotNullableInRulesTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2023 SonarSource SA - * mailto:info 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.server.platform.db.migration.version.v102; - -import java.sql.SQLException; -import org.junit.Rule; -import org.junit.Test; -import org.sonar.db.CoreDbTester; - -import static java.sql.Types.VARCHAR; - -public class MakeCleanCodeAttributeColumnNotNullableInRulesTest { - private static final String TABLE_NAME = "rules"; - private static final String COLUMN_NAME = "clean_code_attribute"; - - @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(MakeCleanCodeAttributeColumnNotNullableInRulesTest.class, "schema.sql"); - - private final MakeCleanCodeAttributeColumnNotNullableInRules underTest = new MakeCleanCodeAttributeColumnNotNullableInRules(db.database()); - - @Test - public void execute_whenColumnIsNullable_shouldMakeColumnNullable() throws SQLException { - db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 40, true); - underTest.execute(); - db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 40, false); - } - - @Test - public void execute_whenExecutedTwice_shouldMakeColumnNullable() throws SQLException { - db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 40, true); - underTest.execute(); - underTest.execute(); - db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 40, false); - } -} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakeProjectUuidNullableInUserDismissedMessagesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakeProjectUuidNullableInUserDismissedMessagesTest.java index 3ed3ab232c9..3f34aece189 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakeProjectUuidNullableInUserDismissedMessagesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakeProjectUuidNullableInUserDismissedMessagesTest.java @@ -22,7 +22,8 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + import static java.sql.Types.VARCHAR; public class MakeProjectUuidNullableInUserDismissedMessagesTest { @@ -31,8 +32,7 @@ public class MakeProjectUuidNullableInUserDismissedMessagesTest { private static final String COLUMN_NAME = "project_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(MakeProjectUuidNullableInUserDismissedMessagesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MakeProjectUuidNullableInUserDismissedMessages.class); private final MakeProjectUuidNullableInUserDismissedMessages underTest = new MakeProjectUuidNullableInUserDismissedMessages(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakePurgedColumnNotNullableInSnapshotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakePurgedColumnNotNullableInSnapshotsTest.java index 9e857e215bc..c341a19dfb7 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakePurgedColumnNotNullableInSnapshotsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/MakePurgedColumnNotNullableInSnapshotsTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.BOOLEAN; @@ -31,8 +31,7 @@ public class MakePurgedColumnNotNullableInSnapshotsTest { private static final String COLUMN_NAME = "purged"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(MakePurgedColumnNotNullableInSnapshotsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MakePurgedColumnNotNullableInSnapshots.class); private final MakePurgedColumnNotNullableInSnapshots underTest = new MakePurgedColumnNotNullableInSnapshots(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulateCleanCodeAttributeColumnInRulesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulateCleanCodeAttributeColumnInRulesTest.java index b65783990e8..2b36cca3e58 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulateCleanCodeAttributeColumnInRulesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulateCleanCodeAttributeColumnInRulesTest.java @@ -25,7 +25,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.api.rules.CleanCodeAttribute; import org.sonar.api.rules.RuleType; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; @@ -35,8 +35,7 @@ public class PopulateCleanCodeAttributeColumnInRulesTest { private static final String TABLE_NAME = "rules"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(PopulateCleanCodeAttributeColumnInRulesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateCleanCodeAttributeColumnInRules.class); private final PopulateCleanCodeAttributeColumnInRules underTest = new PopulateCleanCodeAttributeColumnInRules(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulateDefaultImpactsInRulesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulateDefaultImpactsInRulesTest.java index 59d1d6d6e1d..5d676abd4a0 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulateDefaultImpactsInRulesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulateDefaultImpactsInRulesTest.java @@ -28,7 +28,7 @@ import org.sonar.api.issue.impact.SoftwareQuality; import org.sonar.api.rules.RuleType; import org.sonar.api.testfixtures.log.LogTester; import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; @@ -38,8 +38,7 @@ public class PopulateDefaultImpactsInRulesTest { private static final String TABLE_NAME = "rules"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(PopulateDefaultImpactsInRulesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateDefaultImpactsInRules.class); @Rule public LogTester logTester = new LogTester(); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulatePurgedColumnInSnapshotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulatePurgedColumnInSnapshotsTest.java index f4515138b13..d772c41965d 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulatePurgedColumnInSnapshotsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/PopulatePurgedColumnInSnapshotsTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import javax.annotation.Nullable; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; @@ -33,8 +33,7 @@ public class PopulatePurgedColumnInSnapshotsTest { private static final String TABLE_NAME = "snapshots"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(PopulatePurgedColumnInSnapshotsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulatePurgedColumnInSnapshots.class); private final PopulatePurgedColumnInSnapshots underTest = new PopulatePurgedColumnInSnapshots(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameBuildDateInSnapshotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameBuildDateInSnapshotsTest.java index 62761472ea4..5cd135211f5 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameBuildDateInSnapshotsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameBuildDateInSnapshotsTest.java @@ -23,14 +23,15 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class RenameBuildDateInSnapshotsTest { private static final String TABLE_NAME = "snapshots"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(RenameBuildDateInSnapshotsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameBuildDateInSnapshots.class); private final RenameBuildDateInSnapshots underTest = new RenameBuildDateInSnapshots(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInGroupRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInGroupRolesTest.java index 33419e2a005..5961204794c 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInGroupRolesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInGroupRolesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; @@ -31,8 +31,7 @@ public class RenameComponentUuidInGroupRolesTest { public static final String NEW_COLUMN_NAME = "entity_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(RenameComponentUuidInGroupRolesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameComponentUuidInGroupRoles.class); private final RenameComponentUuidInGroupRoles underTest = new RenameComponentUuidInGroupRoles(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInSnapshotsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInSnapshotsTest.java index cea6152f2e8..f189cdd4586 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInSnapshotsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInSnapshotsTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; @@ -31,8 +31,7 @@ public class RenameComponentUuidInSnapshotsTest { public static final String NEW_COLUMN_NAME = "root_component_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(RenameComponentUuidInSnapshotsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameComponentUuidInSnapshots.class); private final RenameComponentUuidInSnapshots underTest = new RenameComponentUuidInSnapshots(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInUserRolesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInUserRolesTest.java index 18a5e5633a5..338f4e46c2f 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInUserRolesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInUserRolesTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; @@ -31,8 +31,7 @@ public class RenameComponentUuidInUserRolesTest { public static final String NEW_COLUMN_NAME = "entity_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(RenameComponentUuidInUserRolesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameComponentUuidInUserRoles.class); private final RenameComponentUuidInUserRoles underTest = new RenameComponentUuidInUserRoles(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInWebhookDeliveriesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInWebhookDeliveriesTest.java index d3c205dd8eb..e383e5d2286 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInWebhookDeliveriesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInWebhookDeliveriesTest.java @@ -20,12 +20,19 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; +import org.junit.Rule; import org.junit.Test; +import org.sonar.db.AbstractDbTester; +import org.sonar.db.TestDb; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.RenameVarcharColumnChange; import org.sonar.server.platform.db.migration.version.RenameVarcharColumnAbstractTest; public class RenameComponentUuidInWebhookDeliveriesTest extends RenameVarcharColumnAbstractTest { + @Rule + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameComponentUuidInWebhookDeliveries.class); + public RenameComponentUuidInWebhookDeliveriesTest() { super("webhook_deliveries", "project_uuid", false); } @@ -45,4 +52,9 @@ public class RenameComponentUuidInWebhookDeliveriesTest extends RenameVarcharCol return new RenameComponentUuidInWebhookDeliveries(db.database()); } + @Override + protected AbstractDbTester<? extends TestDb> getDatabase() { + return db; + } + } diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeActivityTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeActivityTest.java index 44b17854000..88edcc996ac 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeActivityTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeActivityTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; @@ -31,8 +31,7 @@ public class RenameMainComponentUuidInCeActivityTest { public static final String NEW_COLUMN_NAME = "entity_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(RenameMainComponentUuidInCeActivityTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameMainComponentUuidInCeActivity.class); private final RenameMainComponentUuidInCeActivity underTest = new RenameMainComponentUuidInCeActivity(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeQueueTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeQueueTest.java index 5274b002e38..d0d782750f8 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeQueueTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeQueueTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v102; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; @@ -31,8 +31,7 @@ public class RenameMainComponentUuidInCeQueueTest { public static final String NEW_COLUMN_NAME = "entity_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(RenameMainComponentUuidInCeQueueTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameMainComponentUuidInCeQueue.class); private final RenameMainComponentUuidInCeQueue underTest = new RenameMainComponentUuidInCeQueue(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest.java index e2ba8cca0d5..039d7e5d1b2 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v102/UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import javax.annotation.Nullable; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; @@ -35,8 +35,7 @@ public class UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest private static final String BRANCH_UUID = "branch-uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriods.class); public final UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriods underTest = new UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriods(db.database()); @Test @@ -44,8 +43,6 @@ public class UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest insertNewCodePeriods("uuid-1", PROJECT_UUID, BRANCH_UUID, "PREVIOUS_VERSION", null); insertNewCodePeriods("uuid-2", PROJECT_UUID, null, "NUMBER_OF_DAYS", "90"); insertNewCodePeriods("uuid-3", null, null, "NUMBER_OF_DAYS", "97"); - insertNewCodePeriods("uuid-4", null, null, "NUMBER_OF_DAYS", "135"); - underTest.execute(); @@ -55,8 +52,7 @@ public class UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest .containsExactlyInAnyOrder( tuple("uuid-1", null, null), tuple("uuid-2", "90", null), - tuple("uuid-3", "90", "97"), - tuple("uuid-4", "90", "135")); + tuple("uuid-3", "90", "97")); } private void insertNewCodePeriods(String uuid, @Nullable String projectUuid, @Nullable String branchUuid, String type, String value) { diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddCleanCodeAttributeColumnInIssuesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddCleanCodeAttributeColumnInIssuesTableTest.java index fc952e6ec47..8356355d35e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddCleanCodeAttributeColumnInIssuesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddCleanCodeAttributeColumnInIssuesTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThatCode; @@ -32,8 +32,7 @@ public class AddCleanCodeAttributeColumnInIssuesTableTest { private static final String COLUMN_NAME = "clean_code_attribute"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AddCleanCodeAttributeColumnInIssuesTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddCleanCodeAttributeColumnInIssuesTable.class); private final AddCleanCodeAttributeColumnInIssuesTable underTest = new AddCleanCodeAttributeColumnInIssuesTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddCreationMethodColumnInProjectsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddCreationMethodColumnInProjectsTableTest.java index b88c1b3ecda..cbf0da11d8d 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddCreationMethodColumnInProjectsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddCreationMethodColumnInProjectsTableTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v103; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; import static org.assertj.core.api.Assertions.assertThatCode; @@ -32,8 +32,7 @@ import static org.sonar.server.platform.db.migration.version.v103.AddCreationMet public class AddCreationMethodColumnInProjectsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AddCreationMethodColumnInProjectsTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddCreationMethodColumnInProjectsTable.class); private final AddCreationMethodColumnInProjectsTable underTest = new AddCreationMethodColumnInProjectsTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddRuleChangesUuidColumnInQProfileChangesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddRuleChangesUuidColumnInQProfileChangesTest.java index 83bd466e690..3312f422f39 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddRuleChangesUuidColumnInQProfileChangesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddRuleChangesUuidColumnInQProfileChangesTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThatCode; @@ -33,8 +33,7 @@ public class AddRuleChangesUuidColumnInQProfileChangesTest { private static final String COLUMN_NAME = "rule_change_uuid"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AddRuleChangesUuidColumnInQProfileChangesTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddRuleChangesUuidColumnInQProfileChanges.class); private final AddRuleChangesUuidColumnInQProfileChanges underTest = new AddRuleChangesUuidColumnInQProfileChanges(db.database()); @Test @@ -50,4 +49,4 @@ public class AddRuleChangesUuidColumnInQProfileChangesTest { assertThatCode(underTest::execute).doesNotThrowAnyException(); } -}
\ No newline at end of file +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddSqVersionColumnInQprofileChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddSqVersionColumnInQprofileChangesTableTest.java index ce13e782a75..cf12a687909 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddSqVersionColumnInQprofileChangesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/AddSqVersionColumnInQprofileChangesTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThatCode; @@ -33,8 +33,7 @@ public class AddSqVersionColumnInQprofileChangesTableTest { private static final String COLUMN_NAME = "sq_version"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(AddSqVersionColumnInQprofileChangesTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddSqVersionColumnInQprofileChangesTable.class); private final AddSqVersionColumnInQprofileChangesTable underTest = new AddSqVersionColumnInQprofileChangesTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateGithubPermissionsMappingTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateGithubPermissionsMappingTableTest.java index 3e0cd7038da..b06bc3569fd 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateGithubPermissionsMappingTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateGithubPermissionsMappingTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; @@ -31,7 +31,7 @@ import static org.sonar.server.platform.db.migration.version.v103.CreateGithubPe public class CreateGithubPermissionsMappingTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateGithubPermissionsMappingTable.class); private final DdlChange createGithubPermissionsMappingTable = new CreateGithubPermissionsMappingTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateIndexForRuleImpactChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateIndexForRuleImpactChangesTableTest.java index 9236c692663..3134d072901 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateIndexForRuleImpactChangesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateIndexForRuleImpactChangesTableTest.java @@ -22,15 +22,16 @@ package org.sonar.server.platform.db.migration.version.v103; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; + + public class CreateIndexForRuleImpactChangesTableTest { static final String INDEX_NAME = "rule_impact_changes_r_c_uuid"; static final String TABLE_NAME = "rule_impact_changes"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateIndexForRuleImpactChangesTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexForRuleImpactChangesTable.class); private final CreateIndexForRuleImpactChangesTable underTest = new CreateIndexForRuleImpactChangesTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleChangesTableTest.java index ad760bb16a9..30466b3ef52 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleChangesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleChangesTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; @@ -33,7 +33,7 @@ public class CreateRuleChangesTableTest { private final static String TABLE_NAME = "rule_changes"; @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateRuleChangesTable.class); private final DdlChange underTest = new CreateRuleChangesTable(db.database()); @@ -60,4 +60,4 @@ public class CreateRuleChangesTableTest { db.assertTableExists(TABLE_NAME); } -}
\ No newline at end of file +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleImpactChangesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleImpactChangesTableTest.java index fe39dfc3bd3..c1b005fa59e 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleImpactChangesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleImpactChangesTableTest.java @@ -23,7 +23,7 @@ import java.sql.SQLException; import java.sql.Types; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DdlChange; import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE; @@ -34,7 +34,7 @@ public class CreateRuleImpactChangesTableTest { private final static String TABLE_NAME = "rule_impact_changes"; @Rule - public final CoreDbTester db = CoreDbTester.createEmpty(); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateRuleImpactChangesTable.class); private final DdlChange underTest = new CreateRuleImpactChangesTable(db.database()); @@ -62,4 +62,4 @@ public class CreateRuleImpactChangesTableTest { db.assertTableExists(TABLE_NAME); } -}
\ No newline at end of file +} diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForGithubPermissionsMappingTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForGithubPermissionsMappingTableTest.java index 0e0f26059ca..9af396ea639 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForGithubPermissionsMappingTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForGithubPermissionsMappingTableTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v103; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.sonar.server.platform.db.migration.version.v103.CreateGithubPermissionsMappingTable.GITHUB_PERMISSIONS_MAPPING_TABLE_NAME; import static org.sonar.server.platform.db.migration.version.v103.CreateGithubPermissionsMappingTable.GITHUB_ROLE_COLUMN; @@ -31,8 +31,7 @@ import static org.sonar.server.platform.db.migration.version.v103.CreateUniqueIn public class CreateUniqueIndexForGithubPermissionsMappingTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateUniqueIndexForGithubPermissionsMappingTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForGithubPermissionsMappingTable.class); private final CreateUniqueIndexForGithubPermissionsMappingTable createIndex = new CreateUniqueIndexForGithubPermissionsMappingTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForPropertiesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForPropertiesTableTest.java index 35c5eb42c6b..e7102b227e2 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForPropertiesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForPropertiesTableTest.java @@ -20,10 +20,9 @@ package org.sonar.server.platform.db.migration.version.v103; import java.sql.SQLException; -import junit.framework.TestCase; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.sonar.server.platform.db.migration.version.v103.CreateUniqueIndexForPropertiesTable.INDEX_NAME; import static org.sonar.server.platform.db.migration.version.v103.CreateUniqueIndexForPropertiesTable.PROPERTIES_TABLE_NAME; @@ -32,8 +31,7 @@ import static org.sonar.server.platform.db.migration.version.v103.CreateUniqueIn public class CreateUniqueIndexForPropertiesTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(CreateUniqueIndexForPropertiesTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForPropertiesTable.class); private final CreateUniqueIndexForPropertiesTable createIndex = new CreateUniqueIndexForPropertiesTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/DeduplicatePropertiesTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/DeduplicatePropertiesTableTest.java index ecae8b64c02..ad572e92cb6 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/DeduplicatePropertiesTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/DeduplicatePropertiesTableTest.java @@ -25,7 +25,7 @@ import javax.annotation.Nullable; import org.junit.Rule; import org.junit.Test; import org.sonar.core.util.Uuids; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; @@ -35,8 +35,7 @@ public class DeduplicatePropertiesTableTest { public static final String ENTITY = "entity"; public static final String USER = "user"; @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DeduplicatePropertiesTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DeduplicatePropertiesTable.class); private final DeduplicatePropertiesTable underTest = new DeduplicatePropertiesTable(db.database()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/MakeCreationMethodColumnInProjectsNotNullableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/MakeCreationMethodColumnInProjectsNotNullableTest.java index 56093c72eeb..2d9347187b1 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/MakeCreationMethodColumnInProjectsNotNullableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/MakeCreationMethodColumnInProjectsNotNullableTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v103; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static java.sql.Types.VARCHAR; import static org.sonar.server.platform.db.migration.version.v103.AddCreationMethodColumnInProjectsTable.PROJECTS_CREATION_METHOD_COLUMN_NAME; @@ -30,8 +30,7 @@ import static org.sonar.server.platform.db.migration.version.v103.AddCreationMet public class MakeCreationMethodColumnInProjectsNotNullableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(MakeCreationMethodColumnInProjectsNotNullableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MakeCreationMethodColumnInProjectsNotNullable.class); private final MakeCreationMethodColumnInProjectsNotNullable underTest = new MakeCreationMethodColumnInProjectsNotNullable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/PopulateCreationMethodColumnInProjectsTableTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/PopulateCreationMethodColumnInProjectsTableTest.java index 3bd16464454..6b2c2761915 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/PopulateCreationMethodColumnInProjectsTableTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/PopulateCreationMethodColumnInProjectsTableTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform.db.migration.version.v103; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.server.platform.db.migration.version.v103.AddCreationMethodColumnInProjectsTable.PROJECTS_TABLE_NAME; @@ -30,8 +30,7 @@ import static org.sonar.server.platform.db.migration.version.v103.AddCreationMet public class PopulateCreationMethodColumnInProjectsTableTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(PopulateCreationMethodColumnInProjectsTableTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateCreationMethodColumnInProjectsTable.class); private final PopulateCreationMethodColumnInProjectsTable underTest = new PopulateCreationMethodColumnInProjectsTable(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/PopulateGithubPermissionsMappingTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/PopulateGithubPermissionsMappingTest.java index 2c1550902f0..28f068b4d73 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/PopulateGithubPermissionsMappingTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/PopulateGithubPermissionsMappingTest.java @@ -24,7 +24,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.api.testfixtures.log.LogTester; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.tuple; @@ -33,8 +33,7 @@ import static org.sonar.server.platform.db.migration.version.v103.CreateGithubPe public class PopulateGithubPermissionsMappingTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(PopulateGithubPermissionsMappingTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateGithubPermissionsMapping.class); @Rule public LogTester logTester = new LogTester(); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/SetAllowQualityProfileDisableInheritedRulesTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/SetAllowQualityProfileDisableInheritedRulesTest.java index 28f98e7ddf5..86ca8e7124a 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/SetAllowQualityProfileDisableInheritedRulesTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v103/SetAllowQualityProfileDisableInheritedRulesTest.java @@ -25,7 +25,7 @@ import org.junit.Test; import org.sonar.api.impl.utils.TestSystem2; import org.sonar.api.utils.System2; import org.sonar.core.util.UuidFactoryFast; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; @@ -34,8 +34,7 @@ public class SetAllowQualityProfileDisableInheritedRulesTest { private static final long NOW = 1; @Rule - public CoreDbTester dbTester = CoreDbTester.createForSchema(SetAllowQualityProfileDisableInheritedRulesTest.class, "schema.sql"); - + public final MigrationDbTester dbTester = MigrationDbTester.createForMigrationStep(SetAllowQualityProfileDisableInheritedRules.class); private final System2 system2 = new TestSystem2().setNow(NOW); private final SetAllowQualityProfileDisableInheritedRules script = new SetAllowQualityProfileDisableInheritedRules(dbTester.database(), system2, UuidFactoryFast.getInstance()); diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v104/DeleteRedundantFailedAlertsForApplicationsTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v104/DeleteRedundantFailedAlertsForApplicationsTest.java index 3c5f92551bf..7d72d4437ee 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v104/DeleteRedundantFailedAlertsForApplicationsTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v104/DeleteRedundantFailedAlertsForApplicationsTest.java @@ -24,7 +24,7 @@ import java.util.Map; import org.junit.Before; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import org.sonar.server.platform.db.migration.step.DataChange; import static org.assertj.core.api.Assertions.assertThat; @@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; public class DeleteRedundantFailedAlertsForApplicationsTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(DeleteRedundantFailedAlertsForApplicationsTest.class, "schema.sql"); + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DeleteRedundantFailedAlertsForApplications.class); private final DataChange underTest = new DeleteRedundantFailedAlertsForApplications(db.database()); @Before diff --git a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v104/RenameWontFixIssuesMetricTest.java b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v104/RenameWontFixIssuesMetricTest.java index 8d8c2a6d328..592b738fde1 100644 --- a/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v104/RenameWontFixIssuesMetricTest.java +++ b/server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v104/RenameWontFixIssuesMetricTest.java @@ -22,15 +22,15 @@ package org.sonar.server.platform.db.migration.version.v104; import java.sql.SQLException; import org.junit.Rule; import org.junit.Test; -import org.sonar.db.CoreDbTester; +import org.sonar.server.platform.db.migration.MigrationDbTester; import static org.assertj.core.api.Assertions.assertThat; + public class RenameWontFixIssuesMetricTest { @Rule - public final CoreDbTester db = CoreDbTester.createForSchema(RenameWontFixIssuesMetricTest.class, "schema.sql"); - + public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameWontFixIssuesMetric.class); private final RenameWontFixIssuesMetric underTest = new RenameWontFixIssuesMetric(db.database()); @Test diff --git a/server/sonar-db-migration/src/test/resources/logback-test.xml b/server/sonar-db-migration/src/test/resources/logback-test.xml new file mode 100644 index 00000000000..fef00563b1a --- /dev/null +++ b/server/sonar-db-migration/src/test/resources/logback-test.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<configuration> + + <appender name="STDOUT" + class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern> + %d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n + </pattern> + </encoder> + </appender> + + <root level="INFO"> + <appender-ref ref="STDOUT"/> + </root> + +</configuration> diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest/empty.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest/empty.sql deleted file mode 100644 index e69de29bb2d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaTest/empty.sql +++ /dev/null diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v00/PopulateInitialSchemaTest/v99.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v00/PopulateInitialSchemaTest/v99.sql deleted file mode 100644 index e966bc8edc9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v00/PopulateInitialSchemaTest/v99.sql +++ /dev/null @@ -1,1042 +0,0 @@ -CREATE TABLE "SCHEMA_MIGRATIONS"( - "VERSION" CHARACTER VARYING(255) NOT NULL -); - -CREATE TABLE "ACTIVE_RULE_PARAMETERS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "VALUE" CHARACTER VARYING(4000), - "RULES_PARAMETER_KEY" CHARACTER VARYING(128), - "ACTIVE_RULE_UUID" CHARACTER VARYING(40) NOT NULL, - "RULES_PARAMETER_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULE_PARAMETERS" ADD CONSTRAINT "PK_ACTIVE_RULE_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "ARP_ACTIVE_RULE_UUID" ON "ACTIVE_RULE_PARAMETERS"("ACTIVE_RULE_UUID" NULLS FIRST); - -CREATE TABLE "ACTIVE_RULES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" CHARACTER VARYING(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "PROFILE_UUID" CHARACTER VARYING(40) NOT NULL, - "RULE_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_UUIDS" ON "ACTIVE_RULES"("PROFILE_UUID" NULLS FIRST, "RULE_UUID" NULLS FIRST); - -CREATE TABLE "ALM_PATS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PAT" CHARACTER VARYING(2000) NOT NULL, - "USER_UUID" CHARACTER VARYING(256) NOT NULL, - "ALM_SETTING_UUID" CHARACTER VARYING(40) NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ALM_PATS" ADD CONSTRAINT "PK_ALM_PATS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_ALM_PATS" ON "ALM_PATS"("USER_UUID" NULLS FIRST, "ALM_SETTING_UUID" NULLS FIRST); - -CREATE TABLE "ALM_SETTINGS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ALM_ID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(200) NOT NULL, - "URL" CHARACTER VARYING(2000), - "APP_ID" CHARACTER VARYING(80), - "PRIVATE_KEY" CHARACTER VARYING(2500), - "PAT" CHARACTER VARYING(2000), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "CLIENT_ID" CHARACTER VARYING(80), - "CLIENT_SECRET" CHARACTER VARYING(160), - "WEBHOOK_SECRET" CHARACTER VARYING(160) -); -ALTER TABLE "ALM_SETTINGS" ADD CONSTRAINT "PK_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_ALM_SETTINGS" ON "ALM_SETTINGS"("KEE" NULLS FIRST); - -CREATE TABLE "ANALYSIS_PROPERTIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ANALYSIS_UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(512) NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "IS_EMPTY" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ANALYSIS_PROPERTIES" ADD CONSTRAINT "PK_ANALYSIS_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "ANALYSIS_PROPERTIES_ANALYSIS" ON "ANALYSIS_PROPERTIES"("ANALYSIS_UUID" NULLS FIRST); - -CREATE TABLE "APP_BRANCH_PROJECT_BRANCH"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "APPLICATION_UUID" CHARACTER VARYING(40) NOT NULL, - "APPLICATION_BRANCH_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_BRANCH_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "APP_BRANCH_PROJECT_BRANCH" ADD CONSTRAINT "PK_APP_BRANCH_PROJECT_BRANCH" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_APP_BRANCH_PROJ" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_BRANCH_UUID" NULLS FIRST, "PROJECT_BRANCH_UUID" NULLS FIRST); -CREATE INDEX "IDX_ABPB_APP_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_UUID" NULLS FIRST); -CREATE INDEX "IDX_ABPB_APP_BRANCH_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("APPLICATION_BRANCH_UUID" NULLS FIRST); -CREATE INDEX "IDX_ABPB_PROJ_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("PROJECT_UUID" NULLS FIRST); -CREATE INDEX "IDX_ABPB_PROJ_BRANCH_UUID" ON "APP_BRANCH_PROJECT_BRANCH"("PROJECT_BRANCH_UUID" NULLS FIRST); - -CREATE TABLE "APP_PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "APPLICATION_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "APP_PROJECTS" ADD CONSTRAINT "PK_APP_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_APP_PROJECTS" ON "APP_PROJECTS"("APPLICATION_UUID" NULLS FIRST, "PROJECT_UUID" NULLS FIRST); -CREATE INDEX "IDX_APP_PROJ_APPLICATION_UUID" ON "APP_PROJECTS"("APPLICATION_UUID" NULLS FIRST); -CREATE INDEX "IDX_APP_PROJ_PROJECT_UUID" ON "APP_PROJECTS"("PROJECT_UUID" NULLS FIRST); - -CREATE TABLE "AUDITS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "USER_LOGIN" CHARACTER VARYING(255) NOT NULL, - "CATEGORY" CHARACTER VARYING(25) NOT NULL, - "OPERATION" CHARACTER VARYING(50) NOT NULL, - "NEW_VALUE" CHARACTER VARYING(4000), - "CREATED_AT" BIGINT NOT NULL, - "USER_TRIGGERED" BOOLEAN DEFAULT TRUE NOT NULL -); -ALTER TABLE "AUDITS" ADD CONSTRAINT "PK_AUDITS" PRIMARY KEY("UUID"); -CREATE INDEX "AUDITS_CREATED_AT" ON "AUDITS"("CREATED_AT" NULLS FIRST); - -CREATE TABLE "CE_ACTIVITY"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(15) NOT NULL, - "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "SUBMITTER_UUID" CHARACTER VARYING(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" CHARACTER VARYING(50), - "ERROR_MESSAGE" CHARACTER VARYING(1000), - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "ERROR_TYPE" CHARACTER VARYING(20), - "WORKER_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "NODE_NAME" CHARACTER VARYING(100) -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY" NULLS FIRST); - -CREATE TABLE "CE_QUEUE"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(15) NOT NULL, - "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15), - "SUBMITTER_UUID" CHARACTER VARYING(255), - "STARTED_AT" BIGINT, - "WORKER_UUID" CHARACTER VARYING(40), - "EXECUTION_COUNT" INTEGER NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_QUEUE" ADD CONSTRAINT "PK_CE_QUEUE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID" NULLS FIRST); - -CREATE TABLE "CE_SCANNER_CONTEXT"( - "TASK_UUID" CHARACTER VARYING(40) NOT NULL, - "CONTEXT_DATA" BINARY LARGE OBJECT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_SCANNER_CONTEXT" ADD CONSTRAINT "PK_CE_SCANNER_CONTEXT" PRIMARY KEY("TASK_UUID"); - -CREATE TABLE "CE_TASK_CHARACTERISTICS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(512) NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(512) -); -ALTER TABLE "CE_TASK_CHARACTERISTICS" ADD CONSTRAINT "PK_CE_TASK_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE INDEX "CE_CHARACTERISTICS_TASK_UUID" ON "CE_TASK_CHARACTERISTICS"("TASK_UUID" NULLS FIRST); - -CREATE TABLE "CE_TASK_INPUT"( - "TASK_UUID" CHARACTER VARYING(40) NOT NULL, - "INPUT_DATA" BINARY LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_TASK_INPUT" ADD CONSTRAINT "PK_CE_TASK_INPUT" PRIMARY KEY("TASK_UUID"); - -CREATE TABLE "CE_TASK_MESSAGE"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_UUID" CHARACTER VARYING(40) NOT NULL, - "MESSAGE" CHARACTER VARYING(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "MESSAGE_TYPE" CHARACTER VARYING(255) NOT NULL -); -ALTER TABLE "CE_TASK_MESSAGE" ADD CONSTRAINT "PK_CE_TASK_MESSAGE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_MESSAGE_TASK" ON "CE_TASK_MESSAGE"("TASK_UUID" NULLS FIRST); -CREATE INDEX "CTM_MESSAGE_TYPE" ON "CE_TASK_MESSAGE"("MESSAGE_TYPE" NULLS FIRST); - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" CHARACTER VARYING(50) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MODULE_UUID" CHARACTER VARYING(50), - "MODULE_UUID_PATH" CHARACTER VARYING(1500), - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "B_MODULE_UUID" CHARACTER VARYING(50), - "B_MODULE_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID" NULLS FIRST); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); - -CREATE TABLE "DEFAULT_QPROFILES"( - "LANGUAGE" CHARACTER VARYING(20) NOT NULL, - "QPROFILE_UUID" CHARACTER VARYING(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "DEFAULT_QPROFILES" ADD CONSTRAINT "PK_DEFAULT_QPROFILES" PRIMARY KEY("LANGUAGE"); -CREATE UNIQUE INDEX "UNIQ_DEFAULT_QPROFILES_UUID" ON "DEFAULT_QPROFILES"("QPROFILE_UUID" NULLS FIRST); - -CREATE TABLE "DEPRECATED_RULE_KEYS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "OLD_REPOSITORY_KEY" CHARACTER VARYING(255) NOT NULL, - "OLD_RULE_KEY" CHARACTER VARYING(200) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "RULE_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "DEPRECATED_RULE_KEYS" ADD CONSTRAINT "PK_DEPRECATED_RULE_KEYS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("OLD_REPOSITORY_KEY" NULLS FIRST, "OLD_RULE_KEY" NULLS FIRST); -CREATE INDEX "RULE_UUID_DEPRECATED_RULE_KEYS" ON "DEPRECATED_RULE_KEYS"("RULE_UUID" NULLS FIRST); - -CREATE TABLE "DUPLICATIONS_INDEX"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "HASH" CHARACTER VARYING(50) NOT NULL, - "INDEX_IN_FILE" INTEGER NOT NULL, - "START_LINE" INTEGER NOT NULL, - "END_LINE" INTEGER NOT NULL -); -ALTER TABLE "DUPLICATIONS_INDEX" ADD CONSTRAINT "PK_DUPLICATIONS_INDEX" PRIMARY KEY("UUID"); -CREATE INDEX "DUPLICATIONS_INDEX_HASH" ON "DUPLICATIONS_INDEX"("HASH" NULLS FIRST); -CREATE INDEX "DUPLICATION_ANALYSIS_COMPONENT" ON "DUPLICATIONS_INDEX"("ANALYSIS_UUID" NULLS FIRST, "COMPONENT_UUID" NULLS FIRST); - -CREATE TABLE "ES_QUEUE"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "DOC_TYPE" CHARACTER VARYING(40) NOT NULL, - "DOC_ID" CHARACTER VARYING(4000) NOT NULL, - "DOC_ID_TYPE" CHARACTER VARYING(20), - "DOC_ROUTING" CHARACTER VARYING(4000), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ES_QUEUE" ADD CONSTRAINT "PK_ES_QUEUE" PRIMARY KEY("UUID"); -CREATE INDEX "ES_QUEUE_CREATED_AT" ON "ES_QUEUE"("CREATED_AT" NULLS FIRST); - -CREATE TABLE "EVENT_COMPONENT_CHANGES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "EVENT_UUID" CHARACTER VARYING(40) NOT NULL, - "EVENT_COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "EVENT_ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, - "CHANGE_CATEGORY" CHARACTER VARYING(12) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_KEY" CHARACTER VARYING(400) NOT NULL, - "COMPONENT_NAME" CHARACTER VARYING(2000) NOT NULL, - "COMPONENT_BRANCH_KEY" CHARACTER VARYING(255), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "EVENT_COMPONENT_CHANGES" ADD CONSTRAINT "PK_EVENT_COMPONENT_CHANGES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "EVENT_COMPONENT_CHANGES_UNIQUE" ON "EVENT_COMPONENT_CHANGES"("EVENT_UUID" NULLS FIRST, "CHANGE_CATEGORY" NULLS FIRST, "COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "EVENT_CPNT_CHANGES_CPNT" ON "EVENT_COMPONENT_CHANGES"("EVENT_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "EVENT_CPNT_CHANGES_ANALYSIS" ON "EVENT_COMPONENT_CHANGES"("EVENT_ANALYSIS_UUID" NULLS FIRST); - -CREATE TABLE "EVENTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, - "NAME" CHARACTER VARYING(400), - "CATEGORY" CHARACTER VARYING(50), - "DESCRIPTION" CHARACTER VARYING(4000), - "EVENT_DATA" CHARACTER VARYING(4000), - "EVENT_DATE" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL -); -ALTER TABLE "EVENTS" ADD CONSTRAINT "PK_EVENTS" PRIMARY KEY("UUID"); -CREATE INDEX "EVENTS_ANALYSIS" ON "EVENTS"("ANALYSIS_UUID" NULLS FIRST); -CREATE INDEX "EVENTS_COMPONENT_UUID" ON "EVENTS"("COMPONENT_UUID" NULLS FIRST); - -CREATE TABLE "FILE_SOURCES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "FILE_UUID" CHARACTER VARYING(50) NOT NULL, - "LINE_HASHES" CHARACTER LARGE OBJECT, - "LINE_HASHES_VERSION" INTEGER, - "DATA_HASH" CHARACTER VARYING(50), - "SRC_HASH" CHARACTER VARYING(50), - "REVISION" CHARACTER VARYING(100), - "LINE_COUNT" INTEGER NOT NULL, - "BINARY_DATA" BINARY LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "FILE_SOURCES" ADD CONSTRAINT "PK_FILE_SOURCES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "FILE_SOURCES_FILE_UUID" ON "FILE_SOURCES"("FILE_UUID" NULLS FIRST); -CREATE INDEX "FILE_SOURCES_PROJECT_UUID" ON "FILE_SOURCES"("PROJECT_UUID" NULLS FIRST); -CREATE INDEX "FILE_SOURCES_UPDATED_AT" ON "FILE_SOURCES"("UPDATED_AT" NULLS FIRST); - -CREATE TABLE "GROUP_ROLES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ROLE" CHARACTER VARYING(64) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40), - "GROUP_UUID" CHARACTER VARYING(40) -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("GROUP_UUID" NULLS FIRST, "COMPONENT_UUID" NULLS FIRST, "ROLE" NULLS FIRST); - -CREATE TABLE "GROUPS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(500) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(200), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "GROUPS" ADD CONSTRAINT "PK_GROUPS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUPS_NAME" ON "GROUPS"("NAME" NULLS FIRST); - -CREATE TABLE "GROUPS_USERS"( - "GROUP_UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL -); -CREATE INDEX "INDEX_GROUPS_USERS_GROUP_UUID" ON "GROUPS_USERS"("GROUP_UUID" NULLS FIRST); -CREATE INDEX "INDEX_GROUPS_USERS_USER_UUID" ON "GROUPS_USERS"("USER_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "GROUPS_USERS_UNIQUE" ON "GROUPS_USERS"("USER_UUID" NULLS FIRST, "GROUP_UUID" NULLS FIRST); - -CREATE TABLE "INTERNAL_COMPONENT_PROPS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(512) NOT NULL, - "VALUE" CHARACTER VARYING(4000), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "INTERNAL_COMPONENT_PROPS" ADD CONSTRAINT "PK_INTERNAL_COMPONENT_PROPS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQUE_COMPONENT_UUID_KEE" ON "INTERNAL_COMPONENT_PROPS"("COMPONENT_UUID" NULLS FIRST, "KEE" NULLS FIRST); - -CREATE TABLE "INTERNAL_PROPERTIES"( - "KEE" CHARACTER VARYING(20) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "INTERNAL_PROPERTIES" ADD CONSTRAINT "PK_INTERNAL_PROPERTIES" PRIMARY KEY("KEE"); - -CREATE TABLE "ISSUE_CHANGES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(50), - "ISSUE_KEY" CHARACTER VARYING(50) NOT NULL, - "USER_LOGIN" CHARACTER VARYING(255), - "CHANGE_TYPE" CHARACTER VARYING(20), - "CHANGE_DATA" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CHANGE_CREATION_DATE" BIGINT, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL -); -ALTER TABLE "ISSUE_CHANGES" ADD CONSTRAINT "PK_ISSUE_CHANGES" PRIMARY KEY("UUID"); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY" ON "ISSUE_CHANGES"("ISSUE_KEY" NULLS FIRST); -CREATE INDEX "ISSUE_CHANGES_KEE" ON "ISSUE_CHANGES"("KEE" NULLS FIRST); -CREATE INDEX "ISSUE_CHANGES_PROJECT_UUID" ON "ISSUE_CHANGES"("PROJECT_UUID" NULLS FIRST); -CREATE INDEX "ISSUE_CHANGES_ISSUE_KEY_TYPE" ON "ISSUE_CHANGES"("ISSUE_KEY" NULLS FIRST, "CHANGE_TYPE" NULLS FIRST); - -CREATE TABLE "ISSUES"( - "KEE" CHARACTER VARYING(50) NOT NULL, - "RULE_UUID" CHARACTER VARYING(40), - "SEVERITY" CHARACTER VARYING(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" CHARACTER VARYING(4000), - "LINE" INTEGER, - "GAP" DOUBLE PRECISION, - "STATUS" CHARACTER VARYING(20), - "RESOLUTION" CHARACTER VARYING(20), - "CHECKSUM" CHARACTER VARYING(1000), - "ASSIGNEE" CHARACTER VARYING(255), - "AUTHOR_LOGIN" CHARACTER VARYING(255), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" CHARACTER VARYING(4000), - "COMPONENT_UUID" CHARACTER VARYING(50), - "PROJECT_UUID" CHARACTER VARYING(50), - "LOCATIONS" BINARY LARGE OBJECT, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN, - "QUICK_FIX_AVAILABLE" BOOLEAN, - "RULE_DESCRIPTION_CONTEXT_KEY" CHARACTER VARYING(50), - "MESSAGE_FORMATTINGS" BINARY LARGE OBJECT -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("KEE"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE" NULLS FIRST); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE" NULLS FIRST); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID" NULLS FIRST); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION" NULLS FIRST); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT" NULLS FIRST); -CREATE INDEX "ISSUES_RULE_UUID" ON "ISSUES"("RULE_UUID" NULLS FIRST); - -CREATE TABLE "LIVE_MEASURES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "METRIC_UUID" CHARACTER VARYING(40) NOT NULL, - "VALUE" DOUBLE PRECISION, - "TEXT_VALUE" CHARACTER VARYING(4000), - "MEASURE_DATA" BINARY LARGE OBJECT, - "UPDATE_MARKER" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "LIVE_MEASURES" ADD CONSTRAINT "PK_LIVE_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "LIVE_MEASURES_PROJECT" ON "LIVE_MEASURES"("PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "LIVE_MEASURES_COMPONENT" ON "LIVE_MEASURES"("COMPONENT_UUID" NULLS FIRST, "METRIC_UUID" NULLS FIRST); - -CREATE TABLE "METRICS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(64) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" CHARACTER VARYING(64), - "SHORT_NAME" CHARACTER VARYING(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" CHARACTER VARYING(8), - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE PRECISION, - "BEST_VALUE" DOUBLE PRECISION, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME" NULLS FIRST); - -CREATE TABLE "NEW_CODE_PERIODS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40), - "BRANCH_UUID" CHARACTER VARYING(40), - "TYPE" CHARACTER VARYING(30) NOT NULL, - "VALUE" CHARACTER VARYING(255), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "NEW_CODE_PERIODS" ADD CONSTRAINT "PK_NEW_CODE_PERIODS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_NEW_CODE_PERIODS" ON "NEW_CODE_PERIODS"("PROJECT_UUID" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); -CREATE INDEX "IDX_NCP_TYPE" ON "NEW_CODE_PERIODS"("TYPE" NULLS FIRST); -CREATE INDEX "IDX_NCP_VALUE" ON "NEW_CODE_PERIODS"("VALUE" NULLS FIRST); - -CREATE TABLE "NEW_CODE_REFERENCE_ISSUES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ISSUE_KEY" CHARACTER VARYING(50) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "NEW_CODE_REFERENCE_ISSUES" ADD CONSTRAINT "PK_NEW_CODE_REFERENCE_ISSUES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_NEW_CODE_REFERENCE_ISSUES" ON "NEW_CODE_REFERENCE_ISSUES"("ISSUE_KEY" NULLS FIRST); - -CREATE TABLE "NOTIFICATIONS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "DATA" BINARY LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "NOTIFICATIONS" ADD CONSTRAINT "PK_NOTIFICATIONS" PRIMARY KEY("UUID"); - -CREATE TABLE "ORG_QPROFILES"( - "UUID" CHARACTER VARYING(255) NOT NULL, - "RULES_PROFILE_UUID" CHARACTER VARYING(255) NOT NULL, - "PARENT_UUID" CHARACTER VARYING(255), - "LAST_USED" BIGINT, - "USER_UPDATED_AT" BIGINT, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "ORG_QPROFILES" ADD CONSTRAINT "PK_ORG_QPROFILES" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILES_RP_UUID" ON "ORG_QPROFILES"("RULES_PROFILE_UUID" NULLS FIRST); -CREATE INDEX "ORG_QPROFILES_PARENT_UUID" ON "ORG_QPROFILES"("PARENT_UUID" NULLS FIRST); - -CREATE TABLE "PERM_TEMPLATES_GROUPS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PERMISSION_REFERENCE" CHARACTER VARYING(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "TEMPLATE_UUID" CHARACTER VARYING(40) NOT NULL, - "GROUP_UUID" CHARACTER VARYING(40) -); -ALTER TABLE "PERM_TEMPLATES_GROUPS" ADD CONSTRAINT "PK_PERM_TEMPLATES_GROUPS" PRIMARY KEY("UUID"); - -CREATE TABLE "PERM_TEMPLATES_USERS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PERMISSION_REFERENCE" CHARACTER VARYING(64) NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "TEMPLATE_UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL -); -ALTER TABLE "PERM_TEMPLATES_USERS" ADD CONSTRAINT "PK_PERM_TEMPLATES_USERS" PRIMARY KEY("UUID"); - -CREATE TABLE "PERM_TPL_CHARACTERISTICS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PERMISSION_KEY" CHARACTER VARYING(64) NOT NULL, - "WITH_PROJECT_CREATOR" BOOLEAN DEFAULT FALSE NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "TEMPLATE_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "PERM_TPL_CHARACTERISTICS" ADD CONSTRAINT "PK_PERM_TPL_CHARACTERISTICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PERM_TPL_CHARAC" ON "PERM_TPL_CHARACTERISTICS"("TEMPLATE_UUID" NULLS FIRST, "PERMISSION_KEY" NULLS FIRST); - -CREATE TABLE "PERMISSION_TEMPLATES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(100) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(4000), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "KEY_PATTERN" CHARACTER VARYING(500) -); -ALTER TABLE "PERMISSION_TEMPLATES" ADD CONSTRAINT "PK_PERMISSION_TEMPLATES" PRIMARY KEY("UUID"); - -CREATE TABLE "PLUGINS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(200) NOT NULL, - "BASE_PLUGIN_KEY" CHARACTER VARYING(200), - "FILE_HASH" CHARACTER VARYING(200) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "TYPE" CHARACTER VARYING(10) NOT NULL, - "REMOVED" BOOLEAN DEFAULT FALSE NOT NULL -); -ALTER TABLE "PLUGINS" ADD CONSTRAINT "PK_PLUGINS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "PLUGINS_KEY" ON "PLUGINS"("KEE" NULLS FIRST); - -CREATE TABLE "PORTFOLIO_PROJ_BRANCHES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PORTFOLIO_PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PORTFOLIO_PROJ_BRANCHES" ADD CONSTRAINT "PK_PORTFOLIO_PROJ_BRANCHES" PRIMARY KEY("UUID"); - -CREATE TABLE "PORTFOLIO_PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PORTFOLIO_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PORTFOLIO_PROJECTS" ADD CONSTRAINT "PK_PORTFOLIO_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIO_PROJECTS" ON "PORTFOLIO_PROJECTS"("PORTFOLIO_UUID" NULLS FIRST, "PROJECT_UUID" NULLS FIRST); - -CREATE TABLE "PORTFOLIO_REFERENCES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PORTFOLIO_UUID" CHARACTER VARYING(40) NOT NULL, - "REFERENCE_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PORTFOLIO_REFERENCES" ADD CONSTRAINT "PK_PORTFOLIO_REFERENCES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIO_REFERENCES" ON "PORTFOLIO_REFERENCES"("PORTFOLIO_UUID" NULLS FIRST, "REFERENCE_UUID" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); - -CREATE TABLE "PORTFOLIOS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "NAME" CHARACTER VARYING(2000) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(2000), - "ROOT_UUID" CHARACTER VARYING(40) NOT NULL, - "PARENT_UUID" CHARACTER VARYING(40), - "PRIVATE" BOOLEAN NOT NULL, - "SELECTION_MODE" CHARACTER VARYING(50) NOT NULL, - "SELECTION_EXPRESSION" CHARACTER VARYING(4000), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "BRANCH_KEY" CHARACTER VARYING(255) -); -ALTER TABLE "PORTFOLIOS" ADD CONSTRAINT "PK_PORTFOLIOS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIOS_KEE" ON "PORTFOLIOS"("KEE" NULLS FIRST); - -CREATE TABLE "PROJECT_ALM_SETTINGS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ALM_SETTING_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "ALM_REPO" CHARACTER VARYING(256), - "ALM_SLUG" CHARACTER VARYING(256), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "SUMMARY_COMMENT_ENABLED" BOOLEAN, - "MONOREPO" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_ALM_SETTINGS" ADD CONSTRAINT "PK_PROJECT_ALM_SETTINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_ALM_SETTINGS" ON "PROJECT_ALM_SETTINGS"("PROJECT_UUID" NULLS FIRST); -CREATE INDEX "PROJECT_ALM_SETTINGS_ALM" ON "PROJECT_ALM_SETTINGS"("ALM_SETTING_UUID" NULLS FIRST); -CREATE INDEX "PROJECT_ALM_SETTINGS_SLUG" ON "PROJECT_ALM_SETTINGS"("ALM_SLUG" NULLS FIRST); - -CREATE TABLE "PROJECT_BADGE_TOKEN"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TOKEN" CHARACTER VARYING(255) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECT_BADGE_TOKEN" ADD CONSTRAINT "PK_PROJECT_BADGE_TOKEN" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BADGE_TOKEN" ON "PROJECT_BADGE_TOKEN"("PROJECT_UUID" NULLS FIRST); - -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(255) NOT NULL, - "BRANCH_TYPE" CHARACTER VARYING(12) NOT NULL, - "MERGE_BRANCH_UUID" CHARACTER VARYING(50), - "PULL_REQUEST_BINARY" BINARY LARGE OBJECT, - "MANUAL_BASELINE_ANALYSIS_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "KEE" NULLS FIRST); - -CREATE TABLE "PROJECT_LINKS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "LINK_TYPE" CHARACTER VARYING(20) NOT NULL, - "NAME" CHARACTER VARYING(128), - "HREF" CHARACTER VARYING(2048) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECT_LINKS" ADD CONSTRAINT "PK_PROJECT_LINKS" PRIMARY KEY("UUID"); -CREATE INDEX "PROJECT_LINKS_PROJECT" ON "PROJECT_LINKS"("PROJECT_UUID" NULLS FIRST); - -CREATE TABLE "PROJECT_MAPPINGS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEY_TYPE" CHARACTER VARYING(200) NOT NULL, - "KEE" CHARACTER VARYING(4000) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECT_MAPPINGS" ADD CONSTRAINT "PK_PROJECT_MAPPINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "KEY_TYPE_KEE" ON "PROJECT_MAPPINGS"("KEY_TYPE" NULLS FIRST, "KEE" NULLS FIRST); -CREATE INDEX "PROJECT_UUID" ON "PROJECT_MAPPINGS"("PROJECT_UUID" NULLS FIRST); - -CREATE TABLE "PROJECT_MEASURES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "VALUE" DOUBLE PRECISION, - "ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "ALERT_STATUS" CHARACTER VARYING(5), - "ALERT_TEXT" CHARACTER VARYING(4000), - "PERSON_ID" INTEGER, - "MEASURE_DATA" BINARY LARGE OBJECT, - "METRIC_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "PROJECT_MEASURES" ADD CONSTRAINT "PK_PROJECT_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "MEASURES_COMPONENT_UUID" ON "PROJECT_MEASURES"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "MEASURES_ANALYSIS_METRIC" ON "PROJECT_MEASURES"("ANALYSIS_UUID" NULLS FIRST, "METRIC_UUID" NULLS FIRST); -CREATE INDEX "PROJECT_MEASURES_METRIC" ON "PROJECT_MEASURES"("METRIC_UUID" NULLS FIRST); - -CREATE TABLE "PROJECT_QGATES"( - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "QUALITY_GATE_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "PROJECT_QGATES" ADD CONSTRAINT "PK_PROJECT_QGATES" PRIMARY KEY("PROJECT_UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QGATES" ON "PROJECT_QGATES"("PROJECT_UUID" NULLS FIRST, "QUALITY_GATE_UUID" NULLS FIRST); - -CREATE TABLE "PROJECT_QPROFILES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "PROFILE_KEY" CHARACTER VARYING(50) NOT NULL -); -ALTER TABLE "PROJECT_QPROFILES" ADD CONSTRAINT "PK_PROJECT_QPROFILES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_QPROFILES" ON "PROJECT_QPROFILES"("PROJECT_UUID" NULLS FIRST, "PROFILE_KEY" NULLS FIRST); - -CREATE TABLE "PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "QUALIFIER" CHARACTER VARYING(10) NOT NULL, - "NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" CHARACTER VARYING(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE" NULLS FIRST); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER" NULLS FIRST); - -CREATE TABLE "PROPERTIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY" NULLS FIRST); - -CREATE TABLE "PUSH_EVENTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "PAYLOAD" BINARY LARGE OBJECT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "LANGUAGE" CHARACTER VARYING(20) -); -ALTER TABLE "PUSH_EVENTS" ADD CONSTRAINT "PK_PUSH_EVENTS" PRIMARY KEY("UUID"); -CREATE INDEX "IDX_PUSH_EVEN_CREA_UUID_PROJ" ON "PUSH_EVENTS"("CREATED_AT" NULLS FIRST, "UUID" NULLS FIRST, "PROJECT_UUID" NULLS FIRST); - -CREATE TABLE "QGATE_GROUP_PERMISSIONS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "QUALITY_GATE_UUID" CHARACTER VARYING(40) NOT NULL, - "GROUP_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QGATE_GROUP_PERMISSIONS" ADD CONSTRAINT "PK_QGATE_GROUP_PERMISSIONS" PRIMARY KEY("UUID"); -CREATE INDEX "QG_GROUPS_UUID_IDX" ON "QGATE_GROUP_PERMISSIONS"("QUALITY_GATE_UUID" NULLS FIRST); - -CREATE TABLE "QGATE_USER_PERMISSIONS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "QUALITY_GATE_UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QGATE_USER_PERMISSIONS" ADD CONSTRAINT "PK_QGATE_USER_PERMISSIONS" PRIMARY KEY("UUID"); -CREATE INDEX "QUALITY_GATE_UUID_IDX" ON "QGATE_USER_PERMISSIONS"("QUALITY_GATE_UUID" NULLS FIRST); - -CREATE TABLE "QPROFILE_CHANGES"( - "KEE" CHARACTER VARYING(40) NOT NULL, - "RULES_PROFILE_UUID" CHARACTER VARYING(255) NOT NULL, - "CHANGE_TYPE" CHARACTER VARYING(20) NOT NULL, - "USER_UUID" CHARACTER VARYING(255), - "CHANGE_DATA" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_CHANGES" ADD CONSTRAINT "PK_QPROFILE_CHANGES" PRIMARY KEY("KEE"); -CREATE INDEX "QP_CHANGES_RULES_PROFILE_UUID" ON "QPROFILE_CHANGES"("RULES_PROFILE_UUID" NULLS FIRST); - -CREATE TABLE "QPROFILE_EDIT_GROUPS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "QPROFILE_UUID" CHARACTER VARYING(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "GROUP_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_GROUPS" ADD CONSTRAINT "PK_QPROFILE_EDIT_GROUPS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_GROUPS_QPROFILE" ON "QPROFILE_EDIT_GROUPS"("QPROFILE_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "QPROFILE_EDIT_GROUPS_UNIQUE" ON "QPROFILE_EDIT_GROUPS"("GROUP_UUID" NULLS FIRST, "QPROFILE_UUID" NULLS FIRST); - -CREATE TABLE "QPROFILE_EDIT_USERS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "QPROFILE_UUID" CHARACTER VARYING(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL -); -ALTER TABLE "QPROFILE_EDIT_USERS" ADD CONSTRAINT "PK_QPROFILE_EDIT_USERS" PRIMARY KEY("UUID"); -CREATE INDEX "QPROFILE_EDIT_USERS_QPROFILE" ON "QPROFILE_EDIT_USERS"("QPROFILE_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "QPROFILE_EDIT_USERS_UNIQUE" ON "QPROFILE_EDIT_USERS"("USER_UUID" NULLS FIRST, "QPROFILE_UUID" NULLS FIRST); - -CREATE TABLE "QUALITY_GATE_CONDITIONS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "OPERATOR" CHARACTER VARYING(3), - "VALUE_ERROR" CHARACTER VARYING(64), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP, - "METRIC_UUID" CHARACTER VARYING(40) NOT NULL, - "QGATE_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "QUALITY_GATE_CONDITIONS" ADD CONSTRAINT "PK_QUALITY_GATE_CONDITIONS" PRIMARY KEY("UUID"); - -CREATE TABLE "QUALITY_GATES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(100) NOT NULL, - "IS_BUILT_IN" BOOLEAN NOT NULL, - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "QUALITY_GATES" ADD CONSTRAINT "PK_QUALITY_GATES" PRIMARY KEY("UUID"); - -CREATE TABLE "RULE_DESC_SECTIONS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "RULE_UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(50) NOT NULL, - "CONTENT" CHARACTER LARGE OBJECT NOT NULL, - "CONTEXT_KEY" CHARACTER VARYING(50), - "CONTEXT_DISPLAY_NAME" CHARACTER VARYING(50) -); -ALTER TABLE "RULE_DESC_SECTIONS" ADD CONSTRAINT "PK_RULE_DESC_SECTIONS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_RULE_DESC_SECTIONS" ON "RULE_DESC_SECTIONS"("RULE_UUID" NULLS FIRST, "KEE" NULLS FIRST, "CONTEXT_KEY" NULLS FIRST); - -CREATE TABLE "RULE_REPOSITORIES"( - "KEE" CHARACTER VARYING(200) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20) NOT NULL, - "NAME" CHARACTER VARYING(4000) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "RULE_REPOSITORIES" ADD CONSTRAINT "PK_RULE_REPOSITORIES" PRIMARY KEY("KEE"); - -CREATE TABLE "RULES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(200), - "PLUGIN_RULE_KEY" CHARACTER VARYING(200) NOT NULL, - "PLUGIN_KEY" CHARACTER VARYING(200), - "PLUGIN_CONFIG_KEY" CHARACTER VARYING(200), - "PLUGIN_NAME" CHARACTER VARYING(255) NOT NULL, - "SCOPE" CHARACTER VARYING(20) NOT NULL, - "PRIORITY" INTEGER, - "STATUS" CHARACTER VARYING(40), - "LANGUAGE" CHARACTER VARYING(20), - "DEF_REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "DEF_REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "DEF_REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "GAP_DESCRIPTION" CHARACTER VARYING(4000), - "SYSTEM_TAGS" CHARACTER VARYING(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" CHARACTER VARYING(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" CHARACTER VARYING(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "TEMPLATE_UUID" CHARACTER VARYING(40), - "NOTE_DATA" CHARACTER LARGE OBJECT, - "NOTE_USER_UUID" CHARACTER VARYING(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "TAGS" CHARACTER VARYING(4000), - "AD_HOC_NAME" CHARACTER VARYING(200), - "AD_HOC_DESCRIPTION" CHARACTER LARGE OBJECT, - "AD_HOC_SEVERITY" CHARACTER VARYING(10), - "AD_HOC_TYPE" TINYINT, - "EDUCATION_PRINCIPLES" CHARACTER VARYING(255) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY" NULLS FIRST, "PLUGIN_NAME" NULLS FIRST); - -CREATE TABLE "RULES_PARAMETERS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(128) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(4000), - "PARAM_TYPE" CHARACTER VARYING(512) NOT NULL, - "DEFAULT_VALUE" CHARACTER VARYING(4000), - "RULE_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "RULES_PARAMETERS" ADD CONSTRAINT "PK_RULES_PARAMETERS" PRIMARY KEY("UUID"); -CREATE INDEX "RULES_PARAMETERS_RULE_UUID" ON "RULES_PARAMETERS"("RULE_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "RULES_PARAMETERS_UNIQUE" ON "RULES_PARAMETERS"("RULE_UUID" NULLS FIRST, "NAME" NULLS FIRST); - -CREATE TABLE "RULES_PROFILES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(100) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" CHARACTER VARYING(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("UUID"); - -CREATE TABLE "SAML_MESSAGE_IDS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "MESSAGE_ID" CHARACTER VARYING(255) NOT NULL, - "EXPIRATION_DATE" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "SAML_MESSAGE_IDS" ADD CONSTRAINT "PK_SAML_MESSAGE_IDS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "SAML_MESSAGE_IDS_UNIQUE" ON "SAML_MESSAGE_IDS"("MESSAGE_ID" NULLS FIRST); - -CREATE TABLE "SCANNER_ANALYSIS_CACHE"( - "BRANCH_UUID" CHARACTER VARYING(40) NOT NULL, - "DATA" BINARY LARGE OBJECT NOT NULL -); -ALTER TABLE "SCANNER_ANALYSIS_CACHE" ADD CONSTRAINT "PK_SCANNER_ANALYSIS_CACHE" PRIMARY KEY("BRANCH_UUID"); - -CREATE TABLE "SCIM_USERS"( - "SCIM_UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "SCIM_USERS" ADD CONSTRAINT "PK_SCIM_USERS" PRIMARY KEY("SCIM_UUID"); -CREATE UNIQUE INDEX "UNIQ_SCIM_USERS_USER_UUID" ON "SCIM_USERS"("USER_UUID" NULLS FIRST); - -CREATE TABLE "SESSION_TOKENS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "EXPIRATION_DATE" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "SESSION_TOKENS" ADD CONSTRAINT "PK_SESSION_TOKENS" PRIMARY KEY("UUID"); -CREATE INDEX "SESSION_TOKENS_USER_UUID" ON "SESSION_TOKENS"("USER_UUID" NULLS FIRST); - -CREATE TABLE "SNAPSHOTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" CHARACTER VARYING(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" CHARACTER VARYING(100), - "REVISION" CHARACTER VARYING(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" CHARACTER VARYING(100), - "PERIOD1_PARAM" CHARACTER VARYING(100), - "PERIOD1_DATE" BIGINT, - "CREATED_AT" BIGINT -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID" NULLS FIRST); - -CREATE TABLE "USER_DISMISSED_MESSAGES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "MESSAGE_TYPE" CHARACTER VARYING(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "USER_DISMISSED_MESSAGES" ADD CONSTRAINT "PK_USER_DISMISSED_MESSAGES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_USER_DISMISSED_MESSAGES" ON "USER_DISMISSED_MESSAGES"("USER_UUID" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "MESSAGE_TYPE" NULLS FIRST); -CREATE INDEX "UDM_PROJECT_UUID" ON "USER_DISMISSED_MESSAGES"("PROJECT_UUID" NULLS FIRST); -CREATE INDEX "UDM_MESSAGE_TYPE" ON "USER_DISMISSED_MESSAGES"("MESSAGE_TYPE" NULLS FIRST); - -CREATE TABLE "USER_ROLES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ROLE" CHARACTER VARYING(64) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_UUID" NULLS FIRST); - -CREATE TABLE "USER_TOKENS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(100) NOT NULL, - "TOKEN_HASH" CHARACTER VARYING(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL, - "PROJECT_KEY" CHARACTER VARYING(255), - "TYPE" CHARACTER VARYING(100) NOT NULL, - "EXPIRATION_DATE" BIGINT -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID" NULLS FIRST, "NAME" NULLS FIRST); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH" NULLS FIRST); - -CREATE TABLE "USERS"( - "UUID" CHARACTER VARYING(255) NOT NULL, - "LOGIN" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(200), - "EMAIL" CHARACTER VARYING(100), - "CRYPTED_PASSWORD" CHARACTER VARYING(100), - "SALT" CHARACTER VARYING(40), - "HASH_METHOD" CHARACTER VARYING(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" CHARACTER VARYING(4000), - "EXTERNAL_LOGIN" CHARACTER VARYING(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" CHARACTER VARYING(100) NOT NULL, - "EXTERNAL_ID" CHARACTER VARYING(255) NOT NULL, - "USER_LOCAL" BOOLEAN, - "HOMEPAGE_TYPE" CHARACTER VARYING(40), - "HOMEPAGE_PARAMETER" CHARACTER VARYING(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "RESET_PASSWORD" BOOLEAN NOT NULL, - "LAST_SONARLINT_CONNECTION" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN" NULLS FIRST); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_ID" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_LOGIN" NULLS FIRST); - -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40) NOT NULL, - "CE_TASK_UUID" CHARACTER VARYING(40), - "ANALYSIS_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "COMPONENT_UUID" ON "WEBHOOK_DELIVERIES"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID" NULLS FIRST); -CREATE INDEX "IDX_WBHK_DLVRS_WBHK_UUID" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID" NULLS FIRST); - -CREATE TABLE "WEBHOOKS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SECRET" CHARACTER VARYING(200), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT -); -ALTER TABLE "WEBHOOKS" ADD CONSTRAINT "PK_WEBHOOKS" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/AddNclocToProjectsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/AddNclocToProjectsTest/schema.sql deleted file mode 100644 index 5cc62fcd124..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/AddNclocToProjectsTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ - -CREATE TABLE "PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "QUALIFIER" CHARACTER VARYING(10) NOT NULL, - "NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" CHARACTER VARYING(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE" NULLS FIRST); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/CreateUniqueIndexForScimGroupsUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/CreateUniqueIndexForScimGroupsUuidTest/schema.sql deleted file mode 100644 index 7028259571b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/CreateUniqueIndexForScimGroupsUuidTest/schema.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE "SCIM_GROUPS"( - "SCIM_UUID" CHARACTER VARYING(40) NOT NULL, - "GROUP_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "SCIM_GROUPS" ADD CONSTRAINT "PK_SCIM_GROUPS" PRIMARY KEY("SCIM_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidInComponentsTest/schema.sql deleted file mode 100644 index 22f6a219db0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidInComponentsTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" CHARACTER VARYING(50) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MODULE_UUID" CHARACTER VARYING(50), - "MODULE_UUID_PATH" CHARACTER VARYING(1500), - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "B_MODULE_UUID" CHARACTER VARYING(50), - "B_MODULE_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidPathInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidPathInComponentsTest/schema.sql deleted file mode 100644 index 22f6a219db0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidPathInComponentsTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" CHARACTER VARYING(50) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MODULE_UUID" CHARACTER VARYING(50), - "MODULE_UUID_PATH" CHARACTER VARYING(1500), - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "B_MODULE_UUID" CHARACTER VARYING(50), - "B_MODULE_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest/schema.sql deleted file mode 100644 index 4d80e3aa7e1..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" CHARACTER VARYING(50) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MODULE_UUID" CHARACTER VARYING(50), - "MODULE_UUID_PATH" CHARACTER VARYING(1500), - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "B_MODULE_UUID" CHARACTER VARYING(50), - "B_MODULE_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_MODULE_UUID" ON "COMPONENTS"("MODULE_UUID" NULLS FIRST); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest/schema.sql deleted file mode 100644 index 00a2b7864ae..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsTest/schema.sql +++ /dev/null @@ -1,37 +0,0 @@ - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" CHARACTER VARYING(50) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidInComponentsTest/schema.sql deleted file mode 100644 index 22f6a219db0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidInComponentsTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" CHARACTER VARYING(50) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MODULE_UUID" CHARACTER VARYING(50), - "MODULE_UUID_PATH" CHARACTER VARYING(1500), - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "B_MODULE_UUID" CHARACTER VARYING(50), - "B_MODULE_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidPathInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidPathInComponentsTest/schema.sql deleted file mode 100644 index 22f6a219db0..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidPathInComponentsTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" CHARACTER VARYING(50) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MODULE_UUID" CHARACTER VARYING(50), - "MODULE_UUID_PATH" CHARACTER VARYING(1500), - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "B_MODULE_UUID" CHARACTER VARYING(50), - "B_MODULE_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest/schema.sql deleted file mode 100644 index 00a2b7864ae..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsTest/schema.sql +++ /dev/null @@ -1,37 +0,0 @@ - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "ROOT_UUID" CHARACTER VARYING(50) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "PROJECTS_ROOT_UUID" ON "COMPONENTS"("ROOT_UUID" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropScimUserProvisioningTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropScimUserProvisioningTest/schema.sql deleted file mode 100644 index aa6b7502c27..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropScimUserProvisioningTest/schema.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE "SCIM_USERS"( - "SCIM_UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "SCIM_USERS" ADD CONSTRAINT "PK_SCIM_USERS" PRIMARY KEY("SCIM_UUID"); -CREATE UNIQUE INDEX "UNIQ_SCIM_USERS_USER_UUID" ON "SCIM_USERS"("USER_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropSonarScimEnabledPropertyTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropSonarScimEnabledPropertyTest/schema.sql deleted file mode 100644 index 7aef2dc569b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/DropSonarScimEnabledPropertyTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentPropertyTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentPropertyTest/schema.sql deleted file mode 100644 index 7aef2dc569b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentPropertyTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/MakeColumnUserLocalNotNullableInUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/MakeColumnUserLocalNotNullableInUsersTest/schema.sql deleted file mode 100644 index 134319f2309..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/MakeColumnUserLocalNotNullableInUsersTest/schema.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" CHARACTER VARYING(255) NOT NULL, - "LOGIN" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(200), - "EMAIL" CHARACTER VARYING(100), - "CRYPTED_PASSWORD" CHARACTER VARYING(100), - "SALT" CHARACTER VARYING(40), - "HASH_METHOD" CHARACTER VARYING(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" CHARACTER VARYING(4000), - "EXTERNAL_LOGIN" CHARACTER VARYING(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" CHARACTER VARYING(100) NOT NULL, - "EXTERNAL_ID" CHARACTER VARYING(255) NOT NULL, - "USER_LOCAL" BOOLEAN, - "HOMEPAGE_TYPE" CHARACTER VARYING(40), - "HOMEPAGE_PARAMETER" CHARACTER VARYING(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "RESET_PASSWORD" BOOLEAN NOT NULL, - "LAST_SONARLINT_CONNECTION" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN" NULLS FIRST); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_ID" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_LOGIN" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsTest/schema.sql deleted file mode 100644 index f69434e8266..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsTest/schema.sql +++ /dev/null @@ -1,67 +0,0 @@ -CREATE TABLE "PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "QUALIFIER" CHARACTER VARYING(10) NOT NULL, - "NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" CHARACTER VARYING(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL, - "NCLOC" BIGINT -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE" NULLS FIRST); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER" NULLS FIRST); - -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(255) NOT NULL, - "BRANCH_TYPE" CHARACTER VARYING(12) NOT NULL, - "MERGE_BRANCH_UUID" CHARACTER VARYING(50), - "PULL_REQUEST_BINARY" BINARY LARGE OBJECT, - "MANUAL_BASELINE_ANALYSIS_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "KEE" NULLS FIRST); - -CREATE TABLE "LIVE_MEASURES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "METRIC_UUID" CHARACTER VARYING(40) NOT NULL, - "VALUE" DOUBLE PRECISION, - "TEXT_VALUE" CHARACTER VARYING(4000), - "MEASURE_DATA" BINARY LARGE OBJECT, - "UPDATE_MARKER" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "LIVE_MEASURES" ADD CONSTRAINT "PK_LIVE_MEASURES" PRIMARY KEY("UUID"); -CREATE INDEX "LIVE_MEASURES_PROJECT" ON "LIVE_MEASURES"("PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "LIVE_MEASURES_COMPONENT" ON "LIVE_MEASURES"("COMPONENT_UUID" NULLS FIRST, "METRIC_UUID" NULLS FIRST); - -CREATE TABLE "METRICS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(64) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" CHARACTER VARYING(64), - "SHORT_NAME" CHARACTER VARYING(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" CHARACTER VARYING(8), - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE PRECISION, - "BEST_VALUE" DOUBLE PRECISION, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/RemoveOrphanRulesFromQualityProfilesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/RemoveOrphanRulesFromQualityProfilesTest/schema.sql deleted file mode 100644 index 87917dfc721..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/RemoveOrphanRulesFromQualityProfilesTest/schema.sql +++ /dev/null @@ -1,75 +0,0 @@ -CREATE TABLE "RULES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(200), - "PLUGIN_RULE_KEY" CHARACTER VARYING(200) NOT NULL, - "PLUGIN_KEY" CHARACTER VARYING(200), - "PLUGIN_CONFIG_KEY" CHARACTER VARYING(200), - "PLUGIN_NAME" CHARACTER VARYING(255) NOT NULL, - "SCOPE" CHARACTER VARYING(20) NOT NULL, - "PRIORITY" INTEGER, - "STATUS" CHARACTER VARYING(40), - "LANGUAGE" CHARACTER VARYING(20), - "DEF_REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "DEF_REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "DEF_REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "GAP_DESCRIPTION" CHARACTER VARYING(4000), - "SYSTEM_TAGS" CHARACTER VARYING(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" CHARACTER VARYING(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" CHARACTER VARYING(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "TEMPLATE_UUID" CHARACTER VARYING(40), - "NOTE_DATA" CHARACTER LARGE OBJECT, - "NOTE_USER_UUID" CHARACTER VARYING(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "TAGS" CHARACTER VARYING(4000), - "AD_HOC_NAME" CHARACTER VARYING(200), - "AD_HOC_DESCRIPTION" CHARACTER LARGE OBJECT, - "AD_HOC_SEVERITY" CHARACTER VARYING(10), - "AD_HOC_TYPE" TINYINT, - "EDUCATION_PRINCIPLES" CHARACTER VARYING(255) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY" NULLS FIRST, "PLUGIN_NAME" NULLS FIRST); - -CREATE TABLE "RULES_PROFILES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(100) NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "IS_BUILT_IN" BOOLEAN NOT NULL, - "RULES_UPDATED_AT" CHARACTER VARYING(100), - "CREATED_AT" TIMESTAMP, - "UPDATED_AT" TIMESTAMP -); -ALTER TABLE "RULES_PROFILES" ADD CONSTRAINT "PK_RULES_PROFILES" PRIMARY KEY("UUID"); - -CREATE TABLE "ACTIVE_RULES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "FAILURE_LEVEL" INTEGER NOT NULL, - "INHERITANCE" CHARACTER VARYING(10), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "PROFILE_UUID" CHARACTER VARYING(40) NOT NULL, - "RULE_UUID" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "ACTIVE_RULES" ADD CONSTRAINT "PK_ACTIVE_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROFILE_RULE_UUIDS" ON "ACTIVE_RULES"("PROFILE_UUID" NULLS FIRST, "RULE_UUID" NULLS FIRST); - -CREATE TABLE "QPROFILE_CHANGES"( - "KEE" CHARACTER VARYING(40) NOT NULL, - "RULES_PROFILE_UUID" CHARACTER VARYING(255) NOT NULL, - "CHANGE_TYPE" CHARACTER VARYING(20) NOT NULL, - "USER_UUID" CHARACTER VARYING(255), - "CHANGE_DATA" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_CHANGES" ADD CONSTRAINT "PK_QPROFILE_CHANGES" PRIMARY KEY("KEE"); -CREATE INDEX "QP_CHANGES_RULES_PROFILE_UUID" ON "QPROFILE_CHANGES"("RULES_PROFILE_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersTest/schema.sql deleted file mode 100644 index 134319f2309..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersTest/schema.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" CHARACTER VARYING(255) NOT NULL, - "LOGIN" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(200), - "EMAIL" CHARACTER VARYING(100), - "CRYPTED_PASSWORD" CHARACTER VARYING(100), - "SALT" CHARACTER VARYING(40), - "HASH_METHOD" CHARACTER VARYING(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" CHARACTER VARYING(4000), - "EXTERNAL_LOGIN" CHARACTER VARYING(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" CHARACTER VARYING(100) NOT NULL, - "EXTERNAL_ID" CHARACTER VARYING(255) NOT NULL, - "USER_LOCAL" BOOLEAN, - "HOMEPAGE_TYPE" CHARACTER VARYING(40), - "HOMEPAGE_PARAMETER" CHARACTER VARYING(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "RESET_PASSWORD" BOOLEAN NOT NULL, - "LAST_SONARLINT_CONNECTION" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN" NULLS FIRST); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_ID" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_LOGIN" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/AddCodeVariantsColumnInIssuesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/AddCodeVariantsColumnInIssuesTableTest/schema.sql deleted file mode 100644 index 9b5d22fa6b7..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/AddCodeVariantsColumnInIssuesTableTest/schema.sql +++ /dev/null @@ -1,37 +0,0 @@ -CREATE TABLE "ISSUES"( - "KEE" CHARACTER VARYING(50) NOT NULL, - "RULE_UUID" CHARACTER VARYING(40), - "SEVERITY" CHARACTER VARYING(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" CHARACTER VARYING(4000), - "LINE" INTEGER, - "GAP" DOUBLE PRECISION, - "STATUS" CHARACTER VARYING(20), - "RESOLUTION" CHARACTER VARYING(20), - "CHECKSUM" CHARACTER VARYING(1000), - "ASSIGNEE" CHARACTER VARYING(255), - "AUTHOR_LOGIN" CHARACTER VARYING(255), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" CHARACTER VARYING(4000), - "COMPONENT_UUID" CHARACTER VARYING(50), - "PROJECT_UUID" CHARACTER VARYING(50), - "LOCATIONS" BINARY LARGE OBJECT, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN, - "QUICK_FIX_AVAILABLE" BOOLEAN, - "RULE_DESCRIPTION_CONTEXT_KEY" CHARACTER VARYING(50), - "MESSAGE_FORMATTINGS" BINARY LARGE OBJECT -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("KEE"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE" NULLS FIRST); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE" NULLS FIRST); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID" NULLS FIRST); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION" NULLS FIRST); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT" NULLS FIRST); -CREATE INDEX "ISSUES_RULE_UUID" ON "ISSUES"("RULE_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/AddIsMainColumnInProjectBranchesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/AddIsMainColumnInProjectBranchesTest/schema.sql deleted file mode 100644 index 4b20881e535..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/AddIsMainColumnInProjectBranchesTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(255) NOT NULL, - "BRANCH_TYPE" CHARACTER VARYING(12) NOT NULL, - "MERGE_BRANCH_UUID" CHARACTER VARYING(50), - "PULL_REQUEST_BINARY" BINARY LARGE OBJECT, - "MANUAL_BASELINE_ANALYSIS_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "KEE" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/AlterIsMainColumnInProjectBranchesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/AlterIsMainColumnInProjectBranchesTest/schema.sql deleted file mode 100644 index 198c950996b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/AlterIsMainColumnInProjectBranchesTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(255) NOT NULL, - "BRANCH_TYPE" CHARACTER VARYING(12) NOT NULL, - "MERGE_BRANCH_UUID" CHARACTER VARYING(50), - "PULL_REQUEST_BINARY" BINARY LARGE OBJECT, - "MANUAL_BASELINE_ANALYSIS_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL, - "IS_MAIN" BOOLEAN -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "KEE" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexForEmailOnUsersTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexForEmailOnUsersTableTest/schema.sql deleted file mode 100644 index f2af20405c8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexForEmailOnUsersTableTest/schema.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" CHARACTER VARYING(255) NOT NULL, - "LOGIN" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(200), - "EMAIL" CHARACTER VARYING(100), - "CRYPTED_PASSWORD" CHARACTER VARYING(100), - "SALT" CHARACTER VARYING(40), - "HASH_METHOD" CHARACTER VARYING(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" CHARACTER VARYING(4000), - "EXTERNAL_LOGIN" CHARACTER VARYING(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" CHARACTER VARYING(100) NOT NULL, - "EXTERNAL_ID" CHARACTER VARYING(255) NOT NULL, - "USER_LOCAL" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" CHARACTER VARYING(40), - "HOMEPAGE_PARAMETER" CHARACTER VARYING(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "RESET_PASSWORD" BOOLEAN NOT NULL, - "LAST_SONARLINT_CONNECTION" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN" NULLS FIRST); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_ID" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_LOGIN" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexForScmAccountOnScmAccountsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexForScmAccountOnScmAccountsTableTest/schema.sql deleted file mode 100644 index 7a113bbdda2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexForScmAccountOnScmAccountsTableTest/schema.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE "SCM_ACCOUNTS"( - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "SCM_ACCOUNT" CHARACTER VARYING(255) NOT NULL -); -ALTER TABLE "SCM_ACCOUNTS" ADD CONSTRAINT "PK_SCM_ACCOUNTS" PRIMARY KEY("USER_UUID", "SCM_ACCOUNT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableTest/schema.sql deleted file mode 100644 index c43b1449258..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableTest/schema.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE "EXTERNAL_GROUPS"( - "GROUP_UUID" CHARACTER VARYING(40) NOT NULL, - "EXTERNAL_GROUP_ID" CHARACTER VARYING(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" CHARACTER VARYING(100) NOT NULL -); -ALTER TABLE "EXTERNAL_GROUPS" ADD CONSTRAINT "PK_EXTERNAL_GROUPS" PRIMARY KEY("GROUP_UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexesForScmAccountsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexesForScmAccountsTest/schema.sql deleted file mode 100644 index 7a113bbdda2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateIndexesForScmAccountsTest/schema.sql +++ /dev/null @@ -1,5 +0,0 @@ -CREATE TABLE "SCM_ACCOUNTS"( - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "SCM_ACCOUNT" CHARACTER VARYING(255) NOT NULL -); -ALTER TABLE "SCM_ACCOUNTS" ADD CONSTRAINT "PK_SCM_ACCOUNTS" PRIMARY KEY("USER_UUID", "SCM_ACCOUNT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateProjectUuidInUserTokensTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateProjectUuidInUserTokensTest/schema.sql deleted file mode 100644 index b67d2d94b37..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateProjectUuidInUserTokensTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(100) NOT NULL, - "TOKEN_HASH" CHARACTER VARYING(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL, - "PROJECT_KEY" CHARACTER VARYING(255), - "TYPE" CHARACTER VARYING(100) NOT NULL, - "EXPIRATION_DATE" BIGINT -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID" NULLS FIRST, "NAME" NULLS FIRST); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSchedulesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSchedulesTableTest/schema.sql deleted file mode 100644 index 4f95a63924f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSchedulesTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "REPORT_SCHEDULES" -( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PORTFOLIO_UUID" CHARACTER VARYING(40), - "BRANCH_UUID" CHARACTER VARYING(40), - "LAST_SEND_TIME_IN_MS" BIGINT NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSubscriptionsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSubscriptionsTableTest/schema.sql deleted file mode 100644 index 0eca93708d2..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSubscriptionsTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "REPORT_SUBSCRIPTIONS" -( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PORTFOLIO_UUID" CHARACTER VARYING(40), - "BRANCH_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(40) NOT NULL -); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/DropProjectKeyInUserTokensTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/DropProjectKeyInUserTokensTest/schema.sql deleted file mode 100644 index 64375f3827a..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/DropProjectKeyInUserTokensTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(100) NOT NULL, - "TOKEN_HASH" CHARACTER VARYING(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL, - "PROJECT_KEY" CHARACTER VARYING(255), - "TYPE" CHARACTER VARYING(100) NOT NULL, - "EXPIRATION_DATE" BIGINT, - "PROJECT_UUID" CHARACTER VARYING(40) -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID" NULLS FIRST, "NAME" NULLS FIRST); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/DropScmAccountsInUsersTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/DropScmAccountsInUsersTest/schema.sql deleted file mode 100644 index f2af20405c8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/DropScmAccountsInUsersTest/schema.sql +++ /dev/null @@ -1,27 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" CHARACTER VARYING(255) NOT NULL, - "LOGIN" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(200), - "EMAIL" CHARACTER VARYING(100), - "CRYPTED_PASSWORD" CHARACTER VARYING(100), - "SALT" CHARACTER VARYING(40), - "HASH_METHOD" CHARACTER VARYING(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" CHARACTER VARYING(4000), - "EXTERNAL_LOGIN" CHARACTER VARYING(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" CHARACTER VARYING(100) NOT NULL, - "EXTERNAL_ID" CHARACTER VARYING(255) NOT NULL, - "USER_LOCAL" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" CHARACTER VARYING(40), - "HOMEPAGE_PARAMETER" CHARACTER VARYING(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "RESET_PASSWORD" BOOLEAN NOT NULL, - "LAST_SONARLINT_CONNECTION" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN" NULLS FIRST); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_ID" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_LOGIN" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/FixDifferentUuidsForSubportfoliosTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/FixDifferentUuidsForSubportfoliosTest/schema.sql deleted file mode 100644 index ce64fc3dda3..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/FixDifferentUuidsForSubportfoliosTest/schema.sql +++ /dev/null @@ -1,71 +0,0 @@ -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); - - -CREATE TABLE "PORTFOLIOS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "NAME" CHARACTER VARYING(2000) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(2000), - "ROOT_UUID" CHARACTER VARYING(40) NOT NULL, - "PARENT_UUID" CHARACTER VARYING(40), - "PRIVATE" BOOLEAN NOT NULL, - "SELECTION_MODE" CHARACTER VARYING(50) NOT NULL, - "SELECTION_EXPRESSION" CHARACTER VARYING(4000), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "BRANCH_KEY" CHARACTER VARYING(255) -); -ALTER TABLE "PORTFOLIOS" ADD CONSTRAINT "PK_PORTFOLIOS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIOS_KEE" ON "PORTFOLIOS"("KEE" NULLS FIRST); - -CREATE TABLE "PORTFOLIO_REFERENCES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PORTFOLIO_UUID" CHARACTER VARYING(40) NOT NULL, - "REFERENCE_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PORTFOLIO_REFERENCES" ADD CONSTRAINT "PK_PORTFOLIO_REFERENCES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIO_REFERENCES" ON "PORTFOLIO_REFERENCES"("PORTFOLIO_UUID" NULLS FIRST, "REFERENCE_UUID" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); - -CREATE TABLE "PORTFOLIO_PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PORTFOLIO_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PORTFOLIO_PROJECTS" ADD CONSTRAINT "PK_PORTFOLIO_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIO_PROJECTS" ON "PORTFOLIO_PROJECTS"("PORTFOLIO_UUID" NULLS FIRST, "PROJECT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/IncreaseKeeColumnSizeInInternalPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/IncreaseKeeColumnSizeInInternalPropertiesTest/schema.sql deleted file mode 100644 index 857779bf042..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/IncreaseKeeColumnSizeInInternalPropertiesTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "INTERNAL_PROPERTIES"( - "KEE" CHARACTER VARYING(20) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "INTERNAL_PROPERTIES" ADD CONSTRAINT "PK_INTERNAL_PROPERTIES" PRIMARY KEY("KEE"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeActivityTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeActivityTest/schema.sql deleted file mode 100644 index 2e595540c47..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeActivityTest/schema.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE "CE_ACTIVITY"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(15) NOT NULL, - "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "SUBMITTER_UUID" CHARACTER VARYING(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" CHARACTER VARYING(50), - "ERROR_MESSAGE" CHARACTER VARYING(1000), - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "ERROR_TYPE" CHARACTER VARYING(20), - "WORKER_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "NODE_NAME" CHARACTER VARYING(100) -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeQueueTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeQueueTest/schema.sql deleted file mode 100644 index 9ae76a9d473..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeQueueTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "CE_QUEUE"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(15) NOT NULL, - "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15), - "SUBMITTER_UUID" CHARACTER VARYING(255), - "STARTED_AT" BIGINT, - "WORKER_UUID" CHARACTER VARYING(40), - "EXECUTION_COUNT" INTEGER NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_QUEUE" ADD CONSTRAINT "PK_CE_QUEUE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/MigrateScmAccountsFromUsersToScmAccountsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/MigrateScmAccountsFromUsersToScmAccountsTest/schema.sql deleted file mode 100644 index 2f34178cb08..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/MigrateScmAccountsFromUsersToScmAccountsTest/schema.sql +++ /dev/null @@ -1,33 +0,0 @@ -CREATE TABLE "USERS"( - "UUID" CHARACTER VARYING(255) NOT NULL, - "LOGIN" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(200), - "EMAIL" CHARACTER VARYING(100), - "CRYPTED_PASSWORD" CHARACTER VARYING(100), - "SALT" CHARACTER VARYING(40), - "HASH_METHOD" CHARACTER VARYING(10), - "ACTIVE" BOOLEAN DEFAULT TRUE, - "SCM_ACCOUNTS" CHARACTER VARYING(4000), - "EXTERNAL_LOGIN" CHARACTER VARYING(255) NOT NULL, - "EXTERNAL_IDENTITY_PROVIDER" CHARACTER VARYING(100) NOT NULL, - "EXTERNAL_ID" CHARACTER VARYING(255) NOT NULL, - "USER_LOCAL" BOOLEAN NOT NULL, - "HOMEPAGE_TYPE" CHARACTER VARYING(40), - "HOMEPAGE_PARAMETER" CHARACTER VARYING(40), - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "RESET_PASSWORD" BOOLEAN NOT NULL, - "LAST_SONARLINT_CONNECTION" BIGINT -); -ALTER TABLE "USERS" ADD CONSTRAINT "PK_USERS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS"("LOGIN" NULLS FIRST); -CREATE INDEX "USERS_UPDATED_AT" ON "USERS"("UPDATED_AT" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_ID" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_ID" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_EXTERNAL_LOGIN" ON "USERS"("EXTERNAL_IDENTITY_PROVIDER" NULLS FIRST, "EXTERNAL_LOGIN" NULLS FIRST); - -CREATE TABLE "SCM_ACCOUNTS"( - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "SCM_ACCOUNT" CHARACTER VARYING(255) NOT NULL -); -ALTER TABLE "SCM_ACCOUNTS" ADD CONSTRAINT "PK_SCM_ACCOUNTS" PRIMARY KEY("USER_UUID", "SCM_ACCOUNT"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/PopulateProjectUuidInUserTokensTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/PopulateProjectUuidInUserTokensTest/schema.sql deleted file mode 100644 index ae9e813e805..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/PopulateProjectUuidInUserTokensTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(100) NOT NULL, - "TOKEN_HASH" CHARACTER VARYING(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL, - "PROJECT_KEY" CHARACTER VARYING(255), - "TYPE" CHARACTER VARYING(100) NOT NULL, - "EXPIRATION_DATE" BIGINT, - "PROJECT_UUID" CHARACTER VARYING(40) -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID" NULLS FIRST, "NAME" NULLS FIRST); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH" NULLS FIRST); - -CREATE TABLE "PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "QUALIFIER" CHARACTER VARYING(10) NOT NULL, - "NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" CHARACTER VARYING(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL, - "NCLOC" BIGINT -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE" NULLS FIRST); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedulesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedulesTest/schema.sql deleted file mode 100644 index 25c8a66e983..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedulesTest/schema.sql +++ /dev/null @@ -1,53 +0,0 @@ -CREATE TABLE "REPORT_SCHEDULES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PORTFOLIO_UUID" CHARACTER VARYING(40), - "BRANCH_UUID" CHARACTER VARYING(40), - "LAST_SEND_TIME_IN_MS" BIGINT NOT NULL -); - -CREATE TABLE "PROPERTIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY" NULLS FIRST); - -CREATE TABLE "PORTFOLIOS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "NAME" CHARACTER VARYING(2000) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(2000), - "ROOT_UUID" CHARACTER VARYING(40) NOT NULL, - "PARENT_UUID" CHARACTER VARYING(40), - "PRIVATE" BOOLEAN NOT NULL, - "SELECTION_MODE" CHARACTER VARYING(50) NOT NULL, - "SELECTION_EXPRESSION" CHARACTER VARYING(4000), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "BRANCH_KEY" CHARACTER VARYING(255) -); -ALTER TABLE "PORTFOLIOS" ADD CONSTRAINT "PK_PORTFOLIOS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIOS_KEE" ON "PORTFOLIOS"("KEE" NULLS FIRST); - -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(255) NOT NULL, - "BRANCH_TYPE" CHARACTER VARYING(12) NOT NULL, - "MERGE_BRANCH_UUID" CHARACTER VARYING(50), - "PULL_REQUEST_BINARY" BINARY LARGE OBJECT, - "MANUAL_BASELINE_ANALYSIS_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL, - "IS_MAIN" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "KEE" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptionsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptionsTest/schema.sql deleted file mode 100644 index f83a10fa111..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptionsTest/schema.sql +++ /dev/null @@ -1,53 +0,0 @@ -CREATE TABLE "REPORT_SUBSCRIPTIONS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PORTFOLIO_UUID" CHARACTER VARYING(40), - "BRANCH_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(40) NOT NULL -); - -CREATE TABLE "PROPERTIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY" NULLS FIRST); - -CREATE TABLE "PORTFOLIOS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "NAME" CHARACTER VARYING(2000) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(2000), - "ROOT_UUID" CHARACTER VARYING(40) NOT NULL, - "PARENT_UUID" CHARACTER VARYING(40), - "PRIVATE" BOOLEAN NOT NULL, - "SELECTION_MODE" CHARACTER VARYING(50) NOT NULL, - "SELECTION_EXPRESSION" CHARACTER VARYING(4000), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "BRANCH_KEY" CHARACTER VARYING(255) -); -ALTER TABLE "PORTFOLIOS" ADD CONSTRAINT "PK_PORTFOLIOS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PORTFOLIOS_KEE" ON "PORTFOLIOS"("KEE" NULLS FIRST); - -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(255) NOT NULL, - "BRANCH_TYPE" CHARACTER VARYING(12) NOT NULL, - "MERGE_BRANCH_UUID" CHARACTER VARYING(50), - "PULL_REQUEST_BINARY" BINARY LARGE OBJECT, - "MANUAL_BASELINE_ANALYSIS_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL, - "IS_MAIN" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "KEE" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/RemoveOrphanUserTokensTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/RemoveOrphanUserTokensTest/schema.sql deleted file mode 100644 index 0079535cda8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/RemoveOrphanUserTokensTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "USER_TOKENS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "NAME" CHARACTER VARYING(100) NOT NULL, - "TOKEN_HASH" CHARACTER VARYING(255) NOT NULL, - "LAST_CONNECTION_DATE" BIGINT, - "CREATED_AT" BIGINT NOT NULL, - "PROJECT_KEY" CHARACTER VARYING(255), - "TYPE" CHARACTER VARYING(100) NOT NULL, - "EXPIRATION_DATE" BIGINT, - "PROJECT_UUID" CHARACTER VARYING(40) -); -ALTER TABLE "USER_TOKENS" ADD CONSTRAINT "PK_USER_TOKENS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "USER_TOKENS_USER_UUID_NAME" ON "USER_TOKENS"("USER_UUID" NULLS FIRST, "NAME" NULLS FIRST); -CREATE UNIQUE INDEX "USER_TOKENS_TOKEN_HASH" ON "USER_TOKENS"("TOKEN_HASH" NULLS FIRST); - -CREATE TABLE "PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "QUALIFIER" CHARACTER VARYING(10) NOT NULL, - "NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" CHARACTER VARYING(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL, - "NCLOC" BIGINT -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE" NULLS FIRST); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/RemoveReportPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/RemoveReportPropertiesTest/schema.sql deleted file mode 100644 index cf3cb84e24e..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/RemoveReportPropertiesTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/RenameColumnComponentUuidInPropertiesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/RenameColumnComponentUuidInPropertiesTest/schema.sql deleted file mode 100644 index 809129a890d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/RenameColumnComponentUuidInPropertiesTest/schema.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "PROPERTIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/UpdateIsMainColumnInProjectBranchesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/UpdateIsMainColumnInProjectBranchesTest/schema.sql deleted file mode 100644 index 198c950996b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v101/UpdateIsMainColumnInProjectBranchesTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(255) NOT NULL, - "BRANCH_TYPE" CHARACTER VARYING(12) NOT NULL, - "MERGE_BRANCH_UUID" CHARACTER VARYING(50), - "PULL_REQUEST_BINARY" BINARY LARGE OBJECT, - "MANUAL_BASELINE_ANALYSIS_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL, - "IS_MAIN" BOOLEAN -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "KEE" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/AddCleanCodeAttributeInRulesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/AddCleanCodeAttributeInRulesTest/schema.sql deleted file mode 100644 index 06e99d24329..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/AddCleanCodeAttributeInRulesTest/schema.sql +++ /dev/null @@ -1,41 +0,0 @@ -CREATE TABLE "RULES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(200), - "PLUGIN_RULE_KEY" CHARACTER VARYING(200) NOT NULL, - "PLUGIN_KEY" CHARACTER VARYING(200), - "PLUGIN_CONFIG_KEY" CHARACTER VARYING(200), - "PLUGIN_NAME" CHARACTER VARYING(255) NOT NULL, - "SCOPE" CHARACTER VARYING(20) NOT NULL, - "PRIORITY" INTEGER, - "STATUS" CHARACTER VARYING(40), - "LANGUAGE" CHARACTER VARYING(20), - "DEF_REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "DEF_REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "DEF_REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "GAP_DESCRIPTION" CHARACTER VARYING(4000), - "SYSTEM_TAGS" CHARACTER VARYING(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" CHARACTER VARYING(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" CHARACTER VARYING(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "TEMPLATE_UUID" CHARACTER VARYING(40), - "NOTE_DATA" CHARACTER LARGE OBJECT, - "NOTE_USER_UUID" CHARACTER VARYING(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "TAGS" CHARACTER VARYING(4000), - "AD_HOC_NAME" CHARACTER VARYING(200), - "AD_HOC_DESCRIPTION" CHARACTER LARGE OBJECT, - "AD_HOC_SEVERITY" CHARACTER VARYING(10), - "AD_HOC_TYPE" TINYINT, - "EDUCATION_PRINCIPLES" CHARACTER VARYING(255) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY" NULLS FIRST, "PLUGIN_NAME" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/AddUserConsentRequiredIfGithubAutoProvisioningEnabledTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/AddUserConsentRequiredIfGithubAutoProvisioningEnabledTest/schema.sql deleted file mode 100644 index 5e16ba34ab5..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/AddUserConsentRequiredIfGithubAutoProvisioningEnabledTest/schema.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE TABLE "INTERNAL_PROPERTIES"( - "KEE" CHARACTER VARYING(40) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "INTERNAL_PROPERTIES" ADD CONSTRAINT "PK_INTERNAL_PROPERTIES" PRIMARY KEY("KEE"); - -CREATE TABLE "PROPERTIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES"("PROP_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateBooleanPurgedColumnInSnapshotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateBooleanPurgedColumnInSnapshotsTest/schema.sql deleted file mode 100644 index c11248e5729..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateBooleanPurgedColumnInSnapshotsTest/schema.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "ROOT_COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" CHARACTER VARYING(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" CHARACTER VARYING(100), - "REVISION" CHARACTER VARYING(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" CHARACTER VARYING(100), - "PERIOD1_PARAM" CHARACTER VARYING(100), - "PERIOD1_DATE" BIGINT, - "CREATED_AT" BIGINT -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE INDEX "SNAPSHOTS_ROOT_COMPONENT_UUID" ON "SNAPSHOTS"("ROOT_COMPONENT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexCreatedAtInWebhookDeliveriesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexCreatedAtInWebhookDeliveriesTest/schema.sql deleted file mode 100644 index f5cef78fb4c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexCreatedAtInWebhookDeliveriesTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CE_TASK_UUID" CHARACTER VARYING(40), - "ANALYSIS_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "WD_WEBHOOK_UUID_CREATED_AT" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID", "CREATED_AT" NULLS FIRST); -CREATE INDEX "WD_PROJECT_UUID_CREATED_AT" ON "WEBHOOK_DELIVERIES"("PROJECT_UUID", "CREATED_AT" NULLS FIRST); -CREATE INDEX "WD_CE_TASK_UUID_CREATED_AT" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID", "CREATED_AT" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeActivityTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeActivityTest/schema.sql deleted file mode 100644 index 153197bdebd..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeActivityTest/schema.sql +++ /dev/null @@ -1,31 +0,0 @@ -CREATE TABLE "CE_ACTIVITY"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(40) NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "SUBMITTER_UUID" CHARACTER VARYING(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" CHARACTER VARYING(50), - "ERROR_MESSAGE" CHARACTER VARYING(1000), - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "ERROR_TYPE" CHARACTER VARYING(20), - "WORKER_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "NODE_NAME" CHARACTER VARYING(100) -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeQueueTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeQueueTest/schema.sql deleted file mode 100644 index 9968533f779..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeQueueTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "CE_QUEUE"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(40) NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15), - "SUBMITTER_UUID" CHARACTER VARYING(255), - "STARTED_AT" BIGINT, - "WORKER_UUID" CHARACTER VARYING(40), - "EXECUTION_COUNT" INTEGER NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_QUEUE" ADD CONSTRAINT "PK_CE_QUEUE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInGroupRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInGroupRolesTest/schema.sql deleted file mode 100644 index 6af8c34c780..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInGroupRolesTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ROLE" CHARACTER VARYING(64) NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "GROUP_UUID" CHARACTER VARYING(40) -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("GROUP_UUID" NULLS FIRST, "ENTITY_UUID" NULLS FIRST, "ROLE" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInUserRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInUserRolesTest/schema.sql deleted file mode 100644 index f5c5e45fc29..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInUserRolesTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ROLE" CHARACTER VARYING(64) NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_UUID" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest/schema.sql deleted file mode 100644 index 7bf007ea74c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidCreatedAtInWebhookDeliveriesTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CE_TASK_UUID" CHARACTER VARYING(40), - "ANALYSIS_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID" NULLS FIRST); -CREATE INDEX "WD_WEBHOOK_UUID_CREATED_AT" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID", "CREATED_AT" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInProjectBranchesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInProjectBranchesTest/schema.sql deleted file mode 100644 index 4b20881e535..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInProjectBranchesTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "PROJECT_BRANCHES"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(255) NOT NULL, - "BRANCH_TYPE" CHARACTER VARYING(12) NOT NULL, - "MERGE_BRANCH_UUID" CHARACTER VARYING(50), - "PULL_REQUEST_BINARY" BINARY LARGE OBJECT, - "MANUAL_BASELINE_ANALYSIS_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "EXCLUDE_FROM_PURGE" BOOLEAN DEFAULT FALSE NOT NULL, - "NEED_ISSUE_SYNC" BOOLEAN NOT NULL -); -ALTER TABLE "PROJECT_BRANCHES" ADD CONSTRAINT "PK_PROJECT_BRANCHES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_PROJECT_BRANCHES" ON "PROJECT_BRANCHES"("BRANCH_TYPE" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "KEE" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexRootComponentUuidInSnapshotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexRootComponentUuidInSnapshotsTest/schema.sql deleted file mode 100644 index b9ca75323ec..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexRootComponentUuidInSnapshotsTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "ROOT_COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" CHARACTER VARYING(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" CHARACTER VARYING(100), - "REVISION" CHARACTER VARYING(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" CHARACTER VARYING(100), - "PERIOD1_PARAM" CHARACTER VARYING(100), - "PERIOD1_DATE" BIGINT, - "CREATED_AT" BIGINT -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID");
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest/schema.sql deleted file mode 100644 index 9d4662d563c..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexTaskUuidCreatedAtInWebhookDeliveriesTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CE_TASK_UUID" CHARACTER VARYING(40), - "ANALYSIS_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "WD_WEBHOOK_UUID_CREATED_AT" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID", "CREATED_AT" NULLS FIRST); -CREATE INDEX "WD_PROJECT_UUID_CREATED_AT" ON "WEBHOOK_DELIVERIES"("PROJECT_UUID", "CREATED_AT" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest/schema.sql deleted file mode 100644 index 9a82fc6035d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CE_TASK_UUID" CHARACTER VARYING(40), - "ANALYSIS_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID" NULLS FIRST); -CREATE INDEX "PROJECT_UUID" ON "WEBHOOK_DELIVERIES"("PROJECT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreatePreviousNonCompliantValueInNewCodePeriodsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreatePreviousNonCompliantValueInNewCodePeriodsTest/schema.sql deleted file mode 100644 index f84cd23d0f9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreatePreviousNonCompliantValueInNewCodePeriodsTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "NEW_CODE_PERIODS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40), - "BRANCH_UUID" CHARACTER VARYING(40), - "TYPE" CHARACTER VARYING(30) NOT NULL, - "VALUE" CHARACTER VARYING(255), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "NEW_CODE_PERIODS" ADD CONSTRAINT "PK_NEW_CODE_PERIODS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_NEW_CODE_PERIODS" ON "NEW_CODE_PERIODS"("PROJECT_UUID" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); -CREATE INDEX "IDX_NCP_TYPE" ON "NEW_CODE_PERIODS"("TYPE" NULLS FIRST); -CREATE INDEX "IDX_NCP_VALUE" ON "NEW_CODE_PERIODS"("VALUE" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnIssuesImpactsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnIssuesImpactsTest/schema.sql deleted file mode 100644 index b334698507b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnIssuesImpactsTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "ISSUES_IMPACTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ISSUE_KEY" CHARACTER VARYING(40) NOT NULL, - "SOFTWARE_QUALITY" CHARACTER VARYING(40) NOT NULL, - "SEVERITY" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "ISSUES_IMPACTS" ADD CONSTRAINT "PK_ISSUES_IMPACTS" PRIMARY KEY("UUID"); -CREATE INDEX "ISSUES_IMPACTS_ISSUE_KEY" ON "ISSUES_IMPACTS"("ISSUE_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnRulesDefaultImpactsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnRulesDefaultImpactsTest/schema.sql deleted file mode 100644 index 3e12b77ac47..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnRulesDefaultImpactsTest/schema.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE TABLE "RULES_DEFAULT_IMPACTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "RULE_UUID" CHARACTER VARYING(40) NOT NULL, - "SOFTWARE_QUALITY" CHARACTER VARYING(40) NOT NULL, - "SEVERITY" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "RULES_DEFAULT_IMPACTS" ADD CONSTRAINT "PK_RULES_DEFAULT_IMPACTS" PRIMARY KEY("UUID"); -CREATE INDEX "RUL_DEF_IMP_RULE_UUID" ON "RULES_DEFAULT_IMPACTS"("RULE_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInSnapshotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInSnapshotsTest/schema.sql deleted file mode 100644 index 404ebcdf7ec..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInSnapshotsTest/schema.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" CHARACTER VARYING(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" CHARACTER VARYING(100), - "REVISION" CHARACTER VARYING(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" CHARACTER VARYING(100), - "PERIOD1_PARAM" CHARACTER VARYING(100), - "PERIOD1_DATE" BIGINT, - "CREATED_AT" BIGINT -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInWebhookDeliveriesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInWebhookDeliveriesTest/schema.sql deleted file mode 100644 index b6b5b09f142..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInWebhookDeliveriesTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40) NOT NULL, - "CE_TASK_UUID" CHARACTER VARYING(40), - "ANALYSIS_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "COMPONENT_UUID" ON "WEBHOOK_DELIVERIES"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID" NULLS FIRST); -CREATE INDEX "IDX_WBHK_DLVRS_WBHK_UUID" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeActivityTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeActivityTest/schema.sql deleted file mode 100644 index dcb9f3a1dd9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeActivityTest/schema.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE "CE_ACTIVITY"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(40) NOT NULL, - "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "SUBMITTER_UUID" CHARACTER VARYING(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" CHARACTER VARYING(50), - "ERROR_MESSAGE" CHARACTER VARYING(1000), - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "ERROR_TYPE" CHARACTER VARYING(20), - "WORKER_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "NODE_NAME" CHARACTER VARYING(100) -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeQueueTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeQueueTest/schema.sql deleted file mode 100644 index 63136b6cc12..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeQueueTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "CE_QUEUE"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(40) NOT NULL, - "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15), - "SUBMITTER_UUID" CHARACTER VARYING(255), - "STARTED_AT" BIGINT, - "WORKER_UUID" CHARACTER VARYING(40), - "EXECUTION_COUNT" INTEGER NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_QUEUE" ADD CONSTRAINT "PK_CE_QUEUE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexOnMainBranchProjectUuidTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexOnMainBranchProjectUuidTest/schema.sql deleted file mode 100644 index e56d84cbc0d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexOnMainBranchProjectUuidTest/schema.sql +++ /dev/null @@ -1,35 +0,0 @@ - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE INDEX "IDX_MAIN_BRANCH_PRJ_UUID" ON "COMPONENTS"("MAIN_BRANCH_PROJECT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexTaskUuidInWebhookDeliveriesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexTaskUuidInWebhookDeliveriesTest/schema.sql deleted file mode 100644 index 13b16a06c0b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexTaskUuidInWebhookDeliveriesTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CE_TASK_UUID" CHARACTER VARYING(40), - "ANALYSIS_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID" NULLS FIRST); -CREATE INDEX "WD_WEBHOOK_UUID_CREATED_AT" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID", "CREATED_AT" NULLS FIRST); -CREATE INDEX "WD_PROJECT_UUID_CREATED_AT" ON "WEBHOOK_DELIVERIES"("PROJECT_UUID", "CREATED_AT" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexWebhookUuidInWebhookDeliveriesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexWebhookUuidInWebhookDeliveriesTest/schema.sql deleted file mode 100644 index 17a7e961935..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropIndexWebhookUuidInWebhookDeliveriesTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CE_TASK_UUID" CHARACTER VARYING(40), - "ANALYSIS_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID" NULLS FIRST); -CREATE INDEX "IDX_WBHK_DLVRS_WBHK_UUID" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID" NULLS FIRST); -CREATE INDEX "PROJECT_UUID" ON "WEBHOOK_DELIVERIES"("PROJECT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropMainBranchProjectUuidInComponentsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropMainBranchProjectUuidInComponentsTest/schema.sql deleted file mode 100644 index 516b2ad1679..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropMainBranchProjectUuidInComponentsTest/schema.sql +++ /dev/null @@ -1,34 +0,0 @@ - -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "MAIN_BRANCH_PROJECT_UUID" CHARACTER VARYING(50), - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropPurgeStatusColumnInSnapshotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropPurgeStatusColumnInSnapshotsTest/schema.sql deleted file mode 100644 index c5c483c982d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropPurgeStatusColumnInSnapshotsTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "ROOT_COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" CHARACTER VARYING(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" CHARACTER VARYING(100), - "REVISION" CHARACTER VARYING(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" CHARACTER VARYING(100), - "PERIOD1_PARAM" CHARACTER VARYING(100), - "PERIOD1_DATE" BIGINT, - "CREATED_AT" BIGINT, - "PURGED" BOOLEAN NOT NULL -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE INDEX "SNAPSHOTS_ROOT_COMPONENT_UUID" ON "SNAPSHOTS"("ROOT_COMPONENT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropTableProjectMappingsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropTableProjectMappingsTest/schema.sql deleted file mode 100644 index a804385efaa..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/DropTableProjectMappingsTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "PROJECT_MAPPINGS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEY_TYPE" CHARACTER VARYING(200) NOT NULL, - "KEE" CHARACTER VARYING(4000) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "PROJECT_MAPPINGS" ADD CONSTRAINT "PK_PROJECT_MAPPINGS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "KEY_TYPE_KEE" ON "PROJECT_MAPPINGS"("KEY_TYPE" NULLS FIRST, "KEE" NULLS FIRST); -CREATE INDEX "PROJECT_UUID" ON "PROJECT_MAPPINGS"("PROJECT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/FixSqaleIndexMetricDescriptionTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/FixSqaleIndexMetricDescriptionTest/schema.sql deleted file mode 100644 index 973448595df..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/FixSqaleIndexMetricDescriptionTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "METRICS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(64) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" CHARACTER VARYING(64), - "SHORT_NAME" CHARACTER VARYING(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" CHARACTER VARYING(8), - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE PRECISION, - "BEST_VALUE" DOUBLE PRECISION, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/IncreaseIsLastKeyInCeActivityTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/IncreaseIsLastKeyInCeActivityTest/schema.sql deleted file mode 100644 index 73f57a708ad..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/IncreaseIsLastKeyInCeActivityTest/schema.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE "CE_ACTIVITY"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(40) NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "SUBMITTER_UUID" CHARACTER VARYING(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" CHARACTER VARYING(50), - "ERROR_MESSAGE" CHARACTER VARYING(1000), - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "ERROR_TYPE" CHARACTER VARYING(20), - "WORKER_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "NODE_NAME" CHARACTER VARYING(100) -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ENTITY_UUID" ON "CE_ACTIVITY"("ENTITY_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/IncreaseMainIsLastKeyInCeActivityTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/IncreaseMainIsLastKeyInCeActivityTest/schema.sql deleted file mode 100644 index 73f57a708ad..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/IncreaseMainIsLastKeyInCeActivityTest/schema.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE "CE_ACTIVITY"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(40) NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "SUBMITTER_UUID" CHARACTER VARYING(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" CHARACTER VARYING(50), - "ERROR_MESSAGE" CHARACTER VARYING(1000), - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "ERROR_TYPE" CHARACTER VARYING(20), - "WORKER_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "NODE_NAME" CHARACTER VARYING(100) -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ENTITY_UUID" ON "CE_ACTIVITY"("ENTITY_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/MakeCleanCodeAttributeColumnNotNullableInRulesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/MakeCleanCodeAttributeColumnNotNullableInRulesTest/schema.sql deleted file mode 100644 index 6ba0dd13082..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/MakeCleanCodeAttributeColumnNotNullableInRulesTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "RULES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(200), - "PLUGIN_RULE_KEY" CHARACTER VARYING(200) NOT NULL, - "PLUGIN_KEY" CHARACTER VARYING(200), - "PLUGIN_CONFIG_KEY" CHARACTER VARYING(200), - "PLUGIN_NAME" CHARACTER VARYING(255) NOT NULL, - "SCOPE" CHARACTER VARYING(20) NOT NULL, - "PRIORITY" INTEGER, - "STATUS" CHARACTER VARYING(40), - "LANGUAGE" CHARACTER VARYING(20), - "DEF_REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "DEF_REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "DEF_REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "GAP_DESCRIPTION" CHARACTER VARYING(4000), - "SYSTEM_TAGS" CHARACTER VARYING(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" CHARACTER VARYING(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" CHARACTER VARYING(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "TEMPLATE_UUID" CHARACTER VARYING(40), - "NOTE_DATA" CHARACTER LARGE OBJECT, - "NOTE_USER_UUID" CHARACTER VARYING(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "TAGS" CHARACTER VARYING(4000), - "AD_HOC_NAME" CHARACTER VARYING(200), - "AD_HOC_DESCRIPTION" CHARACTER LARGE OBJECT, - "AD_HOC_SEVERITY" CHARACTER VARYING(10), - "AD_HOC_TYPE" TINYINT, - "EDUCATION_PRINCIPLES" CHARACTER VARYING(255), - "CLEAN_CODE_ATTRIBUTE" CHARACTER VARYING(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY" NULLS FIRST, "PLUGIN_NAME" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/MakeProjectUuidNullableInUserDismissedMessagesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/MakeProjectUuidNullableInUserDismissedMessagesTest/schema.sql deleted file mode 100644 index aa1795f6042..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/MakeProjectUuidNullableInUserDismissedMessagesTest/schema.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "USER_DISMISSED_MESSAGES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "USER_UUID" CHARACTER VARYING(255) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40) NOT NULL, - "MESSAGE_TYPE" CHARACTER VARYING(255) NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "USER_DISMISSED_MESSAGES" ADD CONSTRAINT "PK_USER_DISMISSED_MESSAGES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_USER_DISMISSED_MESSAGES" ON "USER_DISMISSED_MESSAGES"("USER_UUID" NULLS FIRST, "PROJECT_UUID" NULLS FIRST, "MESSAGE_TYPE" NULLS FIRST); -CREATE INDEX "UDM_PROJECT_UUID" ON "USER_DISMISSED_MESSAGES"("PROJECT_UUID" NULLS FIRST); -CREATE INDEX "UDM_MESSAGE_TYPE" ON "USER_DISMISSED_MESSAGES"("MESSAGE_TYPE" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/MakePurgedColumnNotNullableInSnapshotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/MakePurgedColumnNotNullableInSnapshotsTest/schema.sql deleted file mode 100644 index 354baa7eeab..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/MakePurgedColumnNotNullableInSnapshotsTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "ROOT_COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" CHARACTER VARYING(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" CHARACTER VARYING(100), - "REVISION" CHARACTER VARYING(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" CHARACTER VARYING(100), - "PERIOD1_PARAM" CHARACTER VARYING(100), - "PERIOD1_DATE" BIGINT, - "CREATED_AT" BIGINT, - "PURGED" BOOLEAN -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE INDEX "SNAPSHOTS_ROOT_COMPONENT_UUID" ON "SNAPSHOTS"("ROOT_COMPONENT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/PopulateCleanCodeAttributeColumnInRulesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/PopulateCleanCodeAttributeColumnInRulesTest/schema.sql deleted file mode 100644 index 6ba0dd13082..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/PopulateCleanCodeAttributeColumnInRulesTest/schema.sql +++ /dev/null @@ -1,42 +0,0 @@ -CREATE TABLE "RULES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(200), - "PLUGIN_RULE_KEY" CHARACTER VARYING(200) NOT NULL, - "PLUGIN_KEY" CHARACTER VARYING(200), - "PLUGIN_CONFIG_KEY" CHARACTER VARYING(200), - "PLUGIN_NAME" CHARACTER VARYING(255) NOT NULL, - "SCOPE" CHARACTER VARYING(20) NOT NULL, - "PRIORITY" INTEGER, - "STATUS" CHARACTER VARYING(40), - "LANGUAGE" CHARACTER VARYING(20), - "DEF_REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "DEF_REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "DEF_REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "GAP_DESCRIPTION" CHARACTER VARYING(4000), - "SYSTEM_TAGS" CHARACTER VARYING(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" CHARACTER VARYING(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" CHARACTER VARYING(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "TEMPLATE_UUID" CHARACTER VARYING(40), - "NOTE_DATA" CHARACTER LARGE OBJECT, - "NOTE_USER_UUID" CHARACTER VARYING(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "TAGS" CHARACTER VARYING(4000), - "AD_HOC_NAME" CHARACTER VARYING(200), - "AD_HOC_DESCRIPTION" CHARACTER LARGE OBJECT, - "AD_HOC_SEVERITY" CHARACTER VARYING(10), - "AD_HOC_TYPE" TINYINT, - "EDUCATION_PRINCIPLES" CHARACTER VARYING(255), - "CLEAN_CODE_ATTRIBUTE" CHARACTER VARYING(40) -); -ALTER TABLE "RULES" ADD CONSTRAINT "PK_RULES" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES"("PLUGIN_RULE_KEY" NULLS FIRST, "PLUGIN_NAME" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/PopulateDefaultImpactsInRulesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/PopulateDefaultImpactsInRulesTest/schema.sql deleted file mode 100644 index af5f4ff5147..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/PopulateDefaultImpactsInRulesTest/schema.sql +++ /dev/null @@ -1,56 +0,0 @@ -CREATE TABLE "RULES" -( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(200), - "PLUGIN_RULE_KEY" CHARACTER VARYING(200) NOT NULL, - "PLUGIN_KEY" CHARACTER VARYING(200), - "PLUGIN_CONFIG_KEY" CHARACTER VARYING(200), - "PLUGIN_NAME" CHARACTER VARYING(255) NOT NULL, - "SCOPE" CHARACTER VARYING(20) NOT NULL, - "PRIORITY" INTEGER, - "STATUS" CHARACTER VARYING(40), - "LANGUAGE" CHARACTER VARYING(20), - "DEF_REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "DEF_REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "DEF_REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "GAP_DESCRIPTION" CHARACTER VARYING(4000), - "SYSTEM_TAGS" CHARACTER VARYING(4000), - "IS_TEMPLATE" BOOLEAN DEFAULT FALSE NOT NULL, - "DESCRIPTION_FORMAT" CHARACTER VARYING(20), - "RULE_TYPE" TINYINT, - "SECURITY_STANDARDS" CHARACTER VARYING(4000), - "IS_AD_HOC" BOOLEAN NOT NULL, - "IS_EXTERNAL" BOOLEAN NOT NULL, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "TEMPLATE_UUID" CHARACTER VARYING(40), - "NOTE_DATA" CHARACTER LARGE OBJECT, - "NOTE_USER_UUID" CHARACTER VARYING(255), - "NOTE_CREATED_AT" BIGINT, - "NOTE_UPDATED_AT" BIGINT, - "REMEDIATION_FUNCTION" CHARACTER VARYING(20), - "REMEDIATION_GAP_MULT" CHARACTER VARYING(20), - "REMEDIATION_BASE_EFFORT" CHARACTER VARYING(20), - "TAGS" CHARACTER VARYING(4000), - "AD_HOC_NAME" CHARACTER VARYING(200), - "AD_HOC_DESCRIPTION" CHARACTER LARGE OBJECT, - "AD_HOC_SEVERITY" CHARACTER VARYING(10), - "AD_HOC_TYPE" TINYINT, - "EDUCATION_PRINCIPLES" CHARACTER VARYING(255), - "CLEAN_CODE_ATTRIBUTE" CHARACTER VARYING(40) -); -ALTER TABLE "RULES" - ADD CONSTRAINT "PK_RULES" PRIMARY KEY ("UUID"); -CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES" ("PLUGIN_RULE_KEY" NULLS FIRST, "PLUGIN_NAME" NULLS FIRST); - -CREATE TABLE "RULES_DEFAULT_IMPACTS" -( - "UUID" CHARACTER VARYING(40) NOT NULL, - "RULE_UUID" CHARACTER VARYING(40) NOT NULL, - "SOFTWARE_QUALITY" CHARACTER VARYING(40) NOT NULL, - "SEVERITY" CHARACTER VARYING(40) NOT NULL -); -ALTER TABLE "RULES_DEFAULT_IMPACTS" - ADD CONSTRAINT "PK_RULES_DEFAULT_IMPACTS" PRIMARY KEY ("UUID"); -CREATE UNIQUE INDEX "UNIQ_RUL_UUID_SOF_QUAL" ON "RULES_DEFAULT_IMPACTS" ("RULE_UUID" NULLS FIRST, "SOFTWARE_QUALITY" NULLS FIRST); - diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/PopulatePurgedColumnInSnapshotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/PopulatePurgedColumnInSnapshotsTest/schema.sql deleted file mode 100644 index 354baa7eeab..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/PopulatePurgedColumnInSnapshotsTest/schema.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "ROOT_COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" CHARACTER VARYING(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" CHARACTER VARYING(100), - "REVISION" CHARACTER VARYING(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" CHARACTER VARYING(100), - "PERIOD1_PARAM" CHARACTER VARYING(100), - "PERIOD1_DATE" BIGINT, - "CREATED_AT" BIGINT, - "PURGED" BOOLEAN -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE INDEX "SNAPSHOTS_ROOT_COMPONENT_UUID" ON "SNAPSHOTS"("ROOT_COMPONENT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameBuildDateInSnapshotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameBuildDateInSnapshotsTest/schema.sql deleted file mode 100644 index 404ebcdf7ec..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameBuildDateInSnapshotsTest/schema.sql +++ /dev/null @@ -1,17 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" CHARACTER VARYING(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" CHARACTER VARYING(100), - "REVISION" CHARACTER VARYING(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" CHARACTER VARYING(100), - "PERIOD1_PARAM" CHARACTER VARYING(100), - "PERIOD1_DATE" BIGINT, - "CREATED_AT" BIGINT -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID"); -CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS"("COMPONENT_UUID" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInGroupRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInGroupRolesTest/schema.sql deleted file mode 100644 index 28453ffd067..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInGroupRolesTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "GROUP_ROLES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ROLE" CHARACTER VARYING(64) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40), - "GROUP_UUID" CHARACTER VARYING(40) -); -ALTER TABLE "GROUP_ROLES" ADD CONSTRAINT "PK_GROUP_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "GROUP_ROLES_COMPONENT_UUID" ON "GROUP_ROLES"("COMPONENT_UUID" NULLS FIRST); -CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES"("GROUP_UUID" NULLS FIRST, "COMPONENT_UUID" NULLS FIRST, "ROLE" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInSnapshotsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInSnapshotsTest/schema.sql deleted file mode 100644 index 20c3bcce1ef..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInSnapshotsTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "SNAPSHOTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "STATUS" CHARACTER VARYING(4) DEFAULT 'U' NOT NULL, - "ISLAST" BOOLEAN DEFAULT FALSE NOT NULL, - "VERSION" CHARACTER VARYING(500), - "PURGE_STATUS" INTEGER, - "BUILD_STRING" CHARACTER VARYING(100), - "REVISION" CHARACTER VARYING(100), - "BUILD_DATE" BIGINT, - "PERIOD1_MODE" CHARACTER VARYING(100), - "PERIOD1_PARAM" CHARACTER VARYING(100), - "PERIOD1_DATE" BIGINT, - "CREATED_AT" BIGINT -); -ALTER TABLE "SNAPSHOTS" ADD CONSTRAINT "PK_SNAPSHOTS" PRIMARY KEY("UUID");
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInUserRolesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInUserRolesTest/schema.sql deleted file mode 100644 index f19732423ab..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInUserRolesTest/schema.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "USER_ROLES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ROLE" CHARACTER VARYING(64) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "USER_ROLES" ADD CONSTRAINT "PK_USER_ROLES" PRIMARY KEY("UUID"); -CREATE INDEX "USER_ROLES_COMPONENT_UUID" ON "USER_ROLES"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "USER_ROLES_USER" ON "USER_ROLES"("USER_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInWebhookDeliveriesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInWebhookDeliveriesTest/schema.sql deleted file mode 100644 index b6b5b09f142..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInWebhookDeliveriesTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "WEBHOOK_DELIVERIES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "WEBHOOK_UUID" CHARACTER VARYING(40) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(40) NOT NULL, - "CE_TASK_UUID" CHARACTER VARYING(40), - "ANALYSIS_UUID" CHARACTER VARYING(40), - "NAME" CHARACTER VARYING(100) NOT NULL, - "URL" CHARACTER VARYING(2000) NOT NULL, - "SUCCESS" BOOLEAN NOT NULL, - "HTTP_STATUS" INTEGER, - "DURATION_MS" BIGINT NOT NULL, - "PAYLOAD" CHARACTER LARGE OBJECT NOT NULL, - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "WEBHOOK_DELIVERIES" ADD CONSTRAINT "PK_WEBHOOK_DELIVERIES" PRIMARY KEY("UUID"); -CREATE INDEX "COMPONENT_UUID" ON "WEBHOOK_DELIVERIES"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_TASK_UUID" ON "WEBHOOK_DELIVERIES"("CE_TASK_UUID" NULLS FIRST); -CREATE INDEX "IDX_WBHK_DLVRS_WBHK_UUID" ON "WEBHOOK_DELIVERIES"("WEBHOOK_UUID" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeActivityTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeActivityTest/schema.sql deleted file mode 100644 index dcb9f3a1dd9..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeActivityTest/schema.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE "CE_ACTIVITY"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(40) NOT NULL, - "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15) NOT NULL, - "MAIN_IS_LAST" BOOLEAN NOT NULL, - "MAIN_IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "IS_LAST" BOOLEAN NOT NULL, - "IS_LAST_KEY" CHARACTER VARYING(55) NOT NULL, - "SUBMITTER_UUID" CHARACTER VARYING(255), - "SUBMITTED_AT" BIGINT NOT NULL, - "STARTED_AT" BIGINT, - "EXECUTED_AT" BIGINT, - "EXECUTION_COUNT" INTEGER NOT NULL, - "EXECUTION_TIME_MS" BIGINT, - "ANALYSIS_UUID" CHARACTER VARYING(50), - "ERROR_MESSAGE" CHARACTER VARYING(1000), - "ERROR_STACKTRACE" CHARACTER LARGE OBJECT, - "ERROR_TYPE" CHARACTER VARYING(20), - "WORKER_UUID" CHARACTER VARYING(40), - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL, - "NODE_NAME" CHARACTER VARYING(100) -); -ALTER TABLE "CE_ACTIVITY" ADD CONSTRAINT "PK_CE_ACTIVITY" PRIMARY KEY("UUID"); -CREATE INDEX "CE_ACTIVITY_COMPONENT" ON "CE_ACTIVITY"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST" ON "CE_ACTIVITY"("IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_ISLAST_KEY" ON "CE_ACTIVITY"("IS_LAST_KEY" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_COMPONENT" ON "CE_ACTIVITY"("MAIN_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST" ON "CE_ACTIVITY"("MAIN_IS_LAST" NULLS FIRST, "STATUS" NULLS FIRST); -CREATE INDEX "CE_ACTIVITY_MAIN_ISLAST_KEY" ON "CE_ACTIVITY"("MAIN_IS_LAST_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeQueueTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeQueueTest/schema.sql deleted file mode 100644 index 63136b6cc12..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeQueueTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "CE_QUEUE"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "TASK_TYPE" CHARACTER VARYING(40) NOT NULL, - "MAIN_COMPONENT_UUID" CHARACTER VARYING(40), - "COMPONENT_UUID" CHARACTER VARYING(40), - "STATUS" CHARACTER VARYING(15), - "SUBMITTER_UUID" CHARACTER VARYING(255), - "STARTED_AT" BIGINT, - "WORKER_UUID" CHARACTER VARYING(40), - "EXECUTION_COUNT" INTEGER NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "UPDATED_AT" BIGINT NOT NULL -); -ALTER TABLE "CE_QUEUE" ADD CONSTRAINT "PK_CE_QUEUE" PRIMARY KEY("UUID"); -CREATE INDEX "CE_QUEUE_MAIN_COMPONENT" ON "CE_QUEUE"("MAIN_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "CE_QUEUE_COMPONENT" ON "CE_QUEUE"("COMPONENT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest/schema.sql deleted file mode 100644 index 2b41c4acaed..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v102/UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "NEW_CODE_PERIODS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROJECT_UUID" CHARACTER VARYING(40), - "BRANCH_UUID" CHARACTER VARYING(40), - "TYPE" CHARACTER VARYING(30) NOT NULL, - "VALUE" CHARACTER VARYING(255), - "PREVIOUS_NON_COMPLIANT_VALUE" CHARACTER VARYING(255), - "UPDATED_AT" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "NEW_CODE_PERIODS" ADD CONSTRAINT "PK_NEW_CODE_PERIODS" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_NEW_CODE_PERIODS" ON "NEW_CODE_PERIODS"("PROJECT_UUID" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); -CREATE INDEX "IDX_NCP_TYPE" ON "NEW_CODE_PERIODS"("TYPE" NULLS FIRST); -CREATE INDEX "IDX_NCP_VALUE" ON "NEW_CODE_PERIODS"("VALUE" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddCleanCodeAttributeColumnInIssuesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddCleanCodeAttributeColumnInIssuesTableTest/schema.sql deleted file mode 100644 index 2746ed4bc7b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddCleanCodeAttributeColumnInIssuesTableTest/schema.sql +++ /dev/null @@ -1,38 +0,0 @@ -CREATE TABLE "ISSUES"( - "KEE" CHARACTER VARYING(50) NOT NULL, - "RULE_UUID" CHARACTER VARYING(40), - "SEVERITY" CHARACTER VARYING(10), - "MANUAL_SEVERITY" BOOLEAN NOT NULL, - "MESSAGE" CHARACTER VARYING(4000), - "LINE" INTEGER, - "GAP" DOUBLE PRECISION, - "STATUS" CHARACTER VARYING(20), - "RESOLUTION" CHARACTER VARYING(20), - "CHECKSUM" CHARACTER VARYING(1000), - "ASSIGNEE" CHARACTER VARYING(255), - "AUTHOR_LOGIN" CHARACTER VARYING(255), - "EFFORT" INTEGER, - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT, - "ISSUE_CREATION_DATE" BIGINT, - "ISSUE_UPDATE_DATE" BIGINT, - "ISSUE_CLOSE_DATE" BIGINT, - "TAGS" CHARACTER VARYING(4000), - "COMPONENT_UUID" CHARACTER VARYING(50), - "PROJECT_UUID" CHARACTER VARYING(50), - "LOCATIONS" BINARY LARGE OBJECT, - "ISSUE_TYPE" TINYINT, - "FROM_HOTSPOT" BOOLEAN, - "QUICK_FIX_AVAILABLE" BOOLEAN, - "RULE_DESCRIPTION_CONTEXT_KEY" CHARACTER VARYING(50), - "MESSAGE_FORMATTINGS" BINARY LARGE OBJECT, - "CODE_VARIANTS" CHARACTER VARYING(4000) -); -ALTER TABLE "ISSUES" ADD CONSTRAINT "PK_ISSUES" PRIMARY KEY("KEE"); -CREATE INDEX "ISSUES_ASSIGNEE" ON "ISSUES"("ASSIGNEE" NULLS FIRST); -CREATE INDEX "ISSUES_COMPONENT_UUID" ON "ISSUES"("COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "ISSUES_CREATION_DATE" ON "ISSUES"("ISSUE_CREATION_DATE" NULLS FIRST); -CREATE INDEX "ISSUES_PROJECT_UUID" ON "ISSUES"("PROJECT_UUID" NULLS FIRST); -CREATE INDEX "ISSUES_RESOLUTION" ON "ISSUES"("RESOLUTION" NULLS FIRST); -CREATE INDEX "ISSUES_UPDATED_AT" ON "ISSUES"("UPDATED_AT" NULLS FIRST); -CREATE INDEX "ISSUES_RULE_UUID" ON "ISSUES"("RULE_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddCreationMethodColumnInProjectsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddCreationMethodColumnInProjectsTableTest/schema.sql deleted file mode 100644 index 8d4b017f15f..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddCreationMethodColumnInProjectsTableTest/schema.sql +++ /dev/null @@ -1,15 +0,0 @@ -CREATE TABLE "PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "QUALIFIER" CHARACTER VARYING(10) NOT NULL, - "NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" CHARACTER VARYING(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL, - "NCLOC" BIGINT -); -ALTER TABLE "PROJECTS" ADD CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -CREATE UNIQUE NULLS DISTINCT INDEX "UNIQ_PROJECTS_KEE" ON "PROJECTS"("KEE" NULLS FIRST); -CREATE INDEX "IDX_QUALIFIER" ON "PROJECTS"("QUALIFIER" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddRuleChangesUuidColumnInQProfileChangesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddRuleChangesUuidColumnInQProfileChangesTest/schema.sql deleted file mode 100644 index b5df5a1278b..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddRuleChangesUuidColumnInQProfileChangesTest/schema.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "QPROFILE_CHANGES"( - "KEE" CHARACTER VARYING(40) NOT NULL, - "RULES_PROFILE_UUID" CHARACTER VARYING(255) NOT NULL, - "CHANGE_TYPE" CHARACTER VARYING(20) NOT NULL, - "USER_UUID" CHARACTER VARYING(255), - "CHANGE_DATA" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "QPROFILE_CHANGES" ADD CONSTRAINT "PK_QPROFILE_CHANGES" PRIMARY KEY("KEE"); -CREATE INDEX "QP_CHANGES_RULES_PROFILE_UUID" ON "QPROFILE_CHANGES"("RULES_PROFILE_UUID" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddSqVersionColumnInQprofileChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddSqVersionColumnInQprofileChangesTableTest/schema.sql deleted file mode 100644 index 34d1ffa65db..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/AddSqVersionColumnInQprofileChangesTableTest/schema.sql +++ /dev/null @@ -1,13 +0,0 @@ -CREATE TABLE "QPROFILE_CHANGES" -( - "KEE" CHARACTER VARYING(40) NOT NULL, - "RULES_PROFILE_UUID" CHARACTER VARYING(255) NOT NULL, - "CHANGE_TYPE" CHARACTER VARYING(20) NOT NULL, - "USER_UUID" CHARACTER VARYING(255), - "CHANGE_DATA" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "RULE_CHANGE_UUID" CHARACTER VARYING(40) -); -ALTER TABLE "QPROFILE_CHANGES" - ADD CONSTRAINT "PK_QPROFILE_CHANGES" PRIMARY KEY ("KEE"); -CREATE INDEX "QP_CHANGES_RULES_PROFILE_UUID" ON "QPROFILE_CHANGES" ("RULES_PROFILE_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/CreateIndexForRuleImpactChangesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/CreateIndexForRuleImpactChangesTableTest/schema.sql deleted file mode 100644 index c4b945c3a05..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/CreateIndexForRuleImpactChangesTableTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "RULE_IMPACT_CHANGES"( - "NEW_SOFTWARE_QUALITY" CHARACTER VARYING(40) NOT NULL, - "OLD_SOFTWARE_QUALITY" CHARACTER VARYING(40) NOT NULL, - "NEW_SEVERITY" CHARACTER VARYING(40) NOT NULL, - "OLD_SEVERITY" CHARACTER VARYING(40) NOT NULL, - "RULE_CHANGE_UUID" CHARACTER VARYING(40) NOT NULL -);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForGithubPermissionsMappingTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForGithubPermissionsMappingTableTest/schema.sql deleted file mode 100644 index be58344838d..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForGithubPermissionsMappingTableTest/schema.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE TABLE "GITHUB_PERMS_MAPPING"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "GITHUB_ROLE" CHARACTER VARYING(100) NOT NULL, - "SONARQUBE_PERMISSION" CHARACTER VARYING(64) NOT NULL -); -ALTER TABLE "GITHUB_PERMS_MAPPING" ADD CONSTRAINT "PK_GITHUB_PERMS_MAPPING" PRIMARY KEY("UUID"); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForPropertiesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForPropertiesTableTest/schema.sql deleted file mode 100644 index 92be388c2ed..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForPropertiesTableTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "PROPERTIES" -( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" - ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY ("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/DeduplicatePropertiesTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/DeduplicatePropertiesTableTest/schema.sql deleted file mode 100644 index 92be388c2ed..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/DeduplicatePropertiesTableTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "PROPERTIES" -( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" - ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY ("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/MakeCreationMethodColumnInProjectsNotNullableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/MakeCreationMethodColumnInProjectsNotNullableTest/schema.sql deleted file mode 100644 index abf4cecb344..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/MakeCreationMethodColumnInProjectsNotNullableTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -create TABLE "PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "QUALIFIER" CHARACTER VARYING(10) NOT NULL, - "NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" CHARACTER VARYING(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL, - "NCLOC" BIGINT, - "CREATION_METHOD" CHARACTER VARYING(50) -); -alter table "PROJECTS" add CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -create unique NULLS DISTINCT INDEX "UNIQ_PROJECTS_KEE" on "PROJECTS"("KEE" NULLS FIRST); -create index "IDX_QUALIFIER" on "PROJECTS"("QUALIFIER" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/PopulateCreationMethodColumnInProjectsTableTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/PopulateCreationMethodColumnInProjectsTableTest/schema.sql deleted file mode 100644 index abf4cecb344..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/PopulateCreationMethodColumnInProjectsTableTest/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ -create TABLE "PROJECTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "KEE" CHARACTER VARYING(400) NOT NULL, - "QUALIFIER" CHARACTER VARYING(10) NOT NULL, - "NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "PRIVATE" BOOLEAN NOT NULL, - "TAGS" CHARACTER VARYING(500), - "CREATED_AT" BIGINT, - "UPDATED_AT" BIGINT NOT NULL, - "NCLOC" BIGINT, - "CREATION_METHOD" CHARACTER VARYING(50) -); -alter table "PROJECTS" add CONSTRAINT "PK_NEW_PROJECTS" PRIMARY KEY("UUID"); -create unique NULLS DISTINCT INDEX "UNIQ_PROJECTS_KEE" on "PROJECTS"("KEE" NULLS FIRST); -create index "IDX_QUALIFIER" on "PROJECTS"("QUALIFIER" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/PopulateGithubPermissionsMappingTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/PopulateGithubPermissionsMappingTest/schema.sql deleted file mode 100644 index 42fc4f9db89..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/PopulateGithubPermissionsMappingTest/schema.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE TABLE "GITHUB_PERMS_MAPPING"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "GITHUB_ROLE" CHARACTER VARYING(100) NOT NULL, - "SONARQUBE_PERMISSION" CHARACTER VARYING(64) NOT NULL -); -ALTER TABLE "GITHUB_PERMS_MAPPING" ADD CONSTRAINT "PK_GITHUB_PERMS_MAPPING" PRIMARY KEY("UUID"); -CREATE UNIQUE INDEX "UNIQ_GITHUB_PERM_MAPPINGS" ON "GITHUB_PERMS_MAPPING"("GITHUB_ROLE" NULLS FIRST, "SONARQUBE_PERMISSION" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/SetAllowQualityProfileDisableInheritedRulesTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/SetAllowQualityProfileDisableInheritedRulesTest/schema.sql deleted file mode 100644 index b79e586d8ce..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v103/SetAllowQualityProfileDisableInheritedRulesTest/schema.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "PROPERTIES" -( - "UUID" CHARACTER VARYING(40) NOT NULL, - "PROP_KEY" CHARACTER VARYING(512) NOT NULL, - "IS_EMPTY" BOOLEAN NOT NULL, - "TEXT_VALUE" CHARACTER VARYING(4000), - "CLOB_VALUE" CHARACTER LARGE OBJECT, - "CREATED_AT" BIGINT NOT NULL, - "ENTITY_UUID" CHARACTER VARYING(40), - "USER_UUID" CHARACTER VARYING(255) -); -ALTER TABLE "PROPERTIES" - ADD CONSTRAINT "PK_PROPERTIES" PRIMARY KEY ("UUID"); -CREATE INDEX "PROPERTIES_KEY" ON "PROPERTIES" ("PROP_KEY" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v104/DeleteRedundantFailedAlertsForApplicationsTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v104/DeleteRedundantFailedAlertsForApplicationsTest/schema.sql deleted file mode 100644 index 20cd163ec66..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v104/DeleteRedundantFailedAlertsForApplicationsTest/schema.sql +++ /dev/null @@ -1,64 +0,0 @@ -CREATE TABLE "COMPONENTS"( - "UUID" CHARACTER VARYING(50) NOT NULL, - "KEE" CHARACTER VARYING(1000), - "DEPRECATED_KEE" CHARACTER VARYING(400), - "NAME" CHARACTER VARYING(2000), - "LONG_NAME" CHARACTER VARYING(2000), - "DESCRIPTION" CHARACTER VARYING(2000), - "ENABLED" BOOLEAN DEFAULT TRUE NOT NULL, - "SCOPE" CHARACTER VARYING(3), - "QUALIFIER" CHARACTER VARYING(10), - "PRIVATE" BOOLEAN NOT NULL, - "LANGUAGE" CHARACTER VARYING(20), - "COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "PATH" CHARACTER VARYING(2000), - "UUID_PATH" CHARACTER VARYING(1500) NOT NULL, - "BRANCH_UUID" CHARACTER VARYING(50) NOT NULL, - "B_CHANGED" BOOLEAN, - "B_NAME" CHARACTER VARYING(500), - "B_LONG_NAME" CHARACTER VARYING(500), - "B_DESCRIPTION" CHARACTER VARYING(2000), - "B_ENABLED" BOOLEAN, - "B_QUALIFIER" CHARACTER VARYING(10), - "B_LANGUAGE" CHARACTER VARYING(20), - "B_COPY_COMPONENT_UUID" CHARACTER VARYING(50), - "B_PATH" CHARACTER VARYING(2000), - "B_UUID_PATH" CHARACTER VARYING(1500), - "CREATED_AT" TIMESTAMP -); -CREATE INDEX "PROJECTS_QUALIFIER" ON "COMPONENTS"("QUALIFIER" NULLS FIRST); -CREATE UNIQUE NULLS NOT DISTINCT INDEX "COMPONENTS_UUID" ON "COMPONENTS"("UUID" NULLS FIRST); -CREATE INDEX "COMPONENTS_BRANCH_UUID" ON "COMPONENTS"("BRANCH_UUID" NULLS FIRST); -CREATE UNIQUE NULLS NOT DISTINCT INDEX "COMPONENTS_KEE_BRANCH_UUID" ON "COMPONENTS"("KEE" NULLS FIRST, "BRANCH_UUID" NULLS FIRST); - -CREATE TABLE "EVENT_COMPONENT_CHANGES"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "EVENT_UUID" CHARACTER VARYING(40) NOT NULL, - "EVENT_COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "EVENT_ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, - "CHANGE_CATEGORY" CHARACTER VARYING(12) NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL, - "COMPONENT_KEY" CHARACTER VARYING(400) NOT NULL, - "COMPONENT_NAME" CHARACTER VARYING(2000) NOT NULL, - "COMPONENT_BRANCH_KEY" CHARACTER VARYING(255), - "CREATED_AT" BIGINT NOT NULL -); -ALTER TABLE "EVENT_COMPONENT_CHANGES" ADD CONSTRAINT "PK_EVENT_COMPONENT_CHANGES" PRIMARY KEY("UUID"); -CREATE UNIQUE NULLS NOT DISTINCT INDEX "EVENT_COMPONENT_CHANGES_UNIQUE" ON "EVENT_COMPONENT_CHANGES"("EVENT_UUID" NULLS FIRST, "CHANGE_CATEGORY" NULLS FIRST, "COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "EVENT_CPNT_CHANGES_CPNT" ON "EVENT_COMPONENT_CHANGES"("EVENT_COMPONENT_UUID" NULLS FIRST); -CREATE INDEX "EVENT_CPNT_CHANGES_ANALYSIS" ON "EVENT_COMPONENT_CHANGES"("EVENT_ANALYSIS_UUID" NULLS FIRST); - -CREATE TABLE "EVENTS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "ANALYSIS_UUID" CHARACTER VARYING(50) NOT NULL, - "NAME" CHARACTER VARYING(400), - "CATEGORY" CHARACTER VARYING(50), - "DESCRIPTION" CHARACTER VARYING(4000), - "EVENT_DATA" CHARACTER VARYING(4000), - "EVENT_DATE" BIGINT NOT NULL, - "CREATED_AT" BIGINT NOT NULL, - "COMPONENT_UUID" CHARACTER VARYING(50) NOT NULL -); -ALTER TABLE "EVENTS" ADD CONSTRAINT "PK_EVENTS" PRIMARY KEY("UUID"); -CREATE INDEX "EVENTS_ANALYSIS" ON "EVENTS"("ANALYSIS_UUID" NULLS FIRST); -CREATE INDEX "EVENTS_COMPONENT_UUID" ON "EVENTS"("COMPONENT_UUID" NULLS FIRST); diff --git a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v104/RenameWontFixIssuesMetricTest/schema.sql b/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v104/RenameWontFixIssuesMetricTest/schema.sql deleted file mode 100644 index 3cb5d8029d8..00000000000 --- a/server/sonar-db-migration/src/test/resources/org/sonar/server/platform/db/migration/version/v104/RenameWontFixIssuesMetricTest/schema.sql +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE "METRICS"( - "UUID" CHARACTER VARYING(40) NOT NULL, - "NAME" CHARACTER VARYING(64) NOT NULL, - "DESCRIPTION" CHARACTER VARYING(255), - "DIRECTION" INTEGER DEFAULT 0 NOT NULL, - "DOMAIN" CHARACTER VARYING(64), - "SHORT_NAME" CHARACTER VARYING(64), - "QUALITATIVE" BOOLEAN DEFAULT FALSE NOT NULL, - "VAL_TYPE" CHARACTER VARYING(8), - "ENABLED" BOOLEAN DEFAULT TRUE, - "WORST_VALUE" DOUBLE PRECISION, - "BEST_VALUE" DOUBLE PRECISION, - "OPTIMIZED_BEST_VALUE" BOOLEAN, - "HIDDEN" BOOLEAN, - "DELETE_HISTORICAL_DATA" BOOLEAN, - "DECIMAL_SCALE" INTEGER -); -ALTER TABLE "METRICS" ADD CONSTRAINT "PK_METRICS" PRIMARY KEY("UUID"); -CREATE UNIQUE NULLS NOT DISTINCT INDEX "METRICS_UNIQUE_NAME" ON "METRICS"("NAME" NULLS FIRST);
\ No newline at end of file diff --git a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java b/server/sonar-db-migration/src/testFixtures/java/org/sonar/db/SQDatabase.java index 4a3485c6c06..8cfc4375bf5 100644 --- a/server/sonar-db-dao/src/testFixtures/java/org/sonar/db/SQDatabase.java +++ b/server/sonar-db-migration/src/testFixtures/java/org/sonar/db/SQDatabase.java @@ -22,16 +22,18 @@ package org.sonar.db; import java.io.PrintWriter; import java.sql.Connection; import java.sql.SQLException; +import java.util.ArrayList; import java.util.List; +import javax.annotation.Nullable; import javax.sql.DataSource; import org.apache.commons.io.output.NullWriter; import org.apache.ibatis.io.Resources; import org.apache.ibatis.jdbc.ScriptRunner; +import org.slf4j.LoggerFactory; import org.sonar.api.config.internal.MapSettings; import org.sonar.api.config.internal.Settings; import org.sonar.api.utils.System2; import org.sonar.api.utils.Version; -import org.slf4j.LoggerFactory; import org.sonar.core.platform.Container; import org.sonar.core.platform.SonarQubeVersion; import org.sonar.core.platform.SpringComponentContainer; @@ -54,24 +56,58 @@ import static com.google.common.base.Preconditions.checkState; public class SQDatabase extends DefaultDatabase { private static final String IGNORED_KEYWORDS_OPTION = ";NON_KEYWORDS=VALUE"; private final boolean createSchema; + @Nullable + private final Class<? extends MigrationStep> migrationStep; - private SQDatabase(Settings settings, boolean createSchema) { + private SQDatabase(Settings settings, boolean createSchema, @Nullable Class<? extends MigrationStep> migrationStep) { super(new LogbackHelper(), settings); this.createSchema = createSchema; + this.migrationStep = migrationStep; } - public static SQDatabase newDatabase(Settings settings, boolean createSchema) { - return new SQDatabase(settings, createSchema); + public static final class Builder { + String h2Name; + + Settings settings; + + boolean createSchema = false; + + Class<? extends MigrationStep> migrationStep; + + public Builder withSettings(Settings settings) { + this.settings = settings; + return this; + } + + public Builder untilMigrationStep(Class<? extends MigrationStep> migrationStep) { + this.migrationStep = migrationStep; + return this; + } + + public Builder createSchema(boolean createSchema) { + this.createSchema = createSchema; + return this; + } + + public Builder asH2Database(String h2Name) { + this.h2Name = h2Name; + return this; + } + + public SQDatabase build() { + checkState(migrationStep == null || createSchema, "Schema needs to be created to specify migration step"); + checkState(h2Name == null || settings == null, "Settings should not be specified for h2 database"); + return new SQDatabase(h2Name != null ? getSettingsForH2(h2Name) : settings, createSchema, migrationStep); + } } - public static SQDatabase newH2Database(String name, boolean createSchema) { - MapSettings settings = new MapSettings() + private static MapSettings getSettingsForH2(String name) { + return new MapSettings() .setProperty("sonar.jdbc.dialect", "h2") .setProperty("sonar.jdbc.driverClassName", "org.h2.Driver") .setProperty("sonar.jdbc.url", "jdbc:h2:mem:" + name + IGNORED_KEYWORDS_OPTION) .setProperty("sonar.jdbc.username", "sonar") .setProperty("sonar.jdbc.password", "sonar"); - return new SQDatabase(settings, createSchema); } @Override @@ -89,7 +125,7 @@ public class SQDatabase extends DefaultDatabase { NoopDatabase noopDatabase = new NoopDatabase(getDialect(), getDataSource()); // create and populate schema createMigrationHistoryTable(noopDatabase); - executeDbMigrations(noopDatabase); + executeDbMigrations(noopDatabase, migrationStep); } catch (SQLException e) { throw new IllegalStateException("Fail to create schema", e); } finally { @@ -138,7 +174,7 @@ public class SQDatabase extends DefaultDatabase { } } - private void executeDbMigrations(NoopDatabase noopDatabase) { + private static void executeDbMigrations(NoopDatabase noopDatabase, @Nullable Class<? extends MigrationStep> stepClass) { SpringComponentContainer container = new SpringComponentContainer(); container.add(noopDatabase); MigrationConfigurationModule migrationConfigurationModule = new MigrationConfigurationModule(); @@ -155,7 +191,32 @@ public class SQDatabase extends DefaultDatabase { MigrationSteps migrationSteps = migrationContainer.getComponentByType(MigrationSteps.class); MigrationStepsExecutor executor = migrationContainer.getComponentByType(MigrationStepsExecutor.class); - executor.execute(migrationSteps.readAll()); + List<RegisteredMigrationStep> steps = migrationSteps.readAll(); + if (stepClass != null) { + steps = filterUntilStep(steps, stepClass); + } + executor.execute(steps); + } + + private static List<RegisteredMigrationStep> filterUntilStep(List<RegisteredMigrationStep> steps, Class<? extends MigrationStep> stepClass) { + List<RegisteredMigrationStep> filteredSteps = new ArrayList<>(); + boolean found = false; + for (RegisteredMigrationStep step : steps) { + if (step.getStepClass().equals(stepClass)) { + if (!found) { + found = true; + } else { + throw new IllegalArgumentException("Duplicate step " + stepClass + " defined in migration"); + } + } + if (!found) { + filteredSteps.add(step); + } + } + if (!found) { + throw new IllegalArgumentException(stepClass + " not found in the migration steps"); + } + return filteredSteps; } private void createMigrationHistoryTable(NoopDatabase noopDatabase) { |