aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-core
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2020-03-27 10:51:09 +0100
committersonartech <sonartech@sonarsource.com>2020-05-25 20:05:18 +0000
commit42c37450359276e494538931c00d22db1dfb7ee1 (patch)
treec0ff16d13ff6d11b8687097fea6704dd72e542fa /server/sonar-db-core
parent6cc33e5130fe97046e384a39beae29c01be4a005 (diff)
downloadsonarqube-42c37450359276e494538931c00d22db1dfb7ee1.tar.gz
sonarqube-42c37450359276e494538931c00d22db1dfb7ee1.zip
SONAR-13221 Set primary key of 'EVENTS' table to column 'UUID' and drop 'ID'
Diffstat (limited to 'server/sonar-db-core')
-rw-r--r--server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java
index 4daa7612714..2595ae70ae3 100644
--- a/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java
+++ b/server/sonar-db-core/src/testFixtures/java/org/sonar/db/AbstractDbTester.java
@@ -357,6 +357,18 @@ public class AbstractDbTester<T extends TestDb> extends ExternalResource {
}
}
+ public void assertNoPrimaryKey(String tableName) {
+ try (Connection connection = getConnection()) {
+ PK pk = pkOf(connection, tableName.toUpperCase(Locale.ENGLISH));
+ if (pk == null) {
+ pkOf(connection, tableName.toLowerCase(Locale.ENGLISH));
+ }
+ assertThat(pk).as("Primary key is still defined on table %s", tableName).isNull();
+ } catch (SQLException e) {
+ throw new IllegalStateException("Fail to check primary key", e);
+ }
+ }
+
@CheckForNull
private PK pkOf(Connection connection, String tableName) throws SQLException {
try (ResultSet resultSet = connection.getMetaData().getPrimaryKeys(null, null, tableName)) {