Browse Source

SONAR-13985 Drop associated index with primary key on Oracle DB

tags/8.6.0.39681
Jacek 3 years ago
parent
commit
1772f0e74b

+ 2
- 1
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v84/util/DropPrimaryKeySqlGenerator.java View File

@@ -82,7 +82,8 @@ public class DropPrimaryKeySqlGenerator {
statements.add(format("DROP SEQUENCE %s_SEQ", tableName));
}

statements.add(format(GENERIC_DROP_CONSTRAINT_STATEMENT, tableName, constraintName));
// 'drop index' at the end ensures that associated index with primary key will be deleted
statements.add(format(GENERIC_DROP_CONSTRAINT_STATEMENT + " DROP INDEX", tableName, constraintName));
return statements;
}


+ 1
- 1
server/sonar-db-migration/src/test/java/org/sonar/server/platform/db/migration/version/v84/util/DropPrimaryKeySqlGeneratorTest.java View File

@@ -80,7 +80,7 @@ public class DropPrimaryKeySqlGeneratorTest {

assertThat(sqls).containsExactly("DROP TRIGGER issues_IDT",
"DROP SEQUENCE issues_SEQ",
"ALTER TABLE issues DROP CONSTRAINT pk_id");
"ALTER TABLE issues DROP CONSTRAINT pk_id DROP INDEX");
}

@Test

Loading…
Cancel
Save