* Drop tag definition constraint * Add changelog * Add tests * Add tests * Test fix * Also drop resource link target FK * Spotless * Only drop HFJ_RES_LINK target FK when we're on Postgres/MSSQL/Oracle mode * Cleanup and test fixes * Missing commit for #6582 * Clean up pom * Spotless
This commit is contained in:
parent
c171b41f68
commit
16110c5d18
|
@ -563,14 +563,10 @@
|
|||
<dialect>
|
||||
<className>ca.uhn.fhir.jpa.model.dialect.HapiFhirOracleDialect</className>
|
||||
<targetFileName>oracle.sql</targetFileName>
|
||||
<!-- We may be able to do this in a cleaner way once this is resolved: https://hibernate.atlassian.net/browse/HHH-19046 -->
|
||||
<dropStatementsContainingRegex>add constraint FK_RESLINK_TARGET</dropStatementsContainingRegex>
|
||||
</dialect>
|
||||
<dialect>
|
||||
<className>ca.uhn.fhir.jpa.model.dialect.HapiFhirSQLServerDialect</className>
|
||||
<targetFileName>sqlserver.sql</targetFileName>
|
||||
<!-- We may be able to do this in a cleaner way once this is resolved: https://hibernate.atlassian.net/browse/HHH-19046 -->
|
||||
<dropStatementsContainingRegex>add constraint FK_RESLINK_TARGET</dropStatementsContainingRegex>
|
||||
</dialect>
|
||||
<dialect>
|
||||
<className>ca.uhn.fhir.jpa.model.dialect.HapiFhirCockroachDialect</className>
|
||||
|
@ -584,8 +580,6 @@
|
|||
<className>ca.uhn.fhir.jpa.model.dialect.HapiFhirPostgresDialect</className>
|
||||
<targetFileName>postgres.sql</targetFileName>
|
||||
<appendFile>classpath:ca/uhn/fhir/jpa/docs/database/hapifhirpostgres94-init01.sql</appendFile>
|
||||
<!-- We may be able to do this in a cleaner way once this is resolved: https://hibernate.atlassian.net/browse/HHH-19046 -->
|
||||
<dropStatementsContainingRegex>add constraint FK_RESLINK_TARGET</dropStatementsContainingRegex>
|
||||
</dialect>
|
||||
</dialects>
|
||||
</configuration>
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ca.uhn.fhir.tinder.ddl;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.dialect.IHapiFhirDialect;
|
||||
import ca.uhn.fhir.util.ReflectionUtil;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
|
@ -12,6 +14,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
@ -78,6 +81,36 @@ public class GenerateDdlMojo extends AbstractMojo {
|
|||
}
|
||||
|
||||
for (Dialect nextDialect : dialects) {
|
||||
IHapiFhirDialect instance = ReflectionUtil.newInstance(
|
||||
nextDialect.getClassName(), IHapiFhirDialect.class, new Class[0], new Object[0]);
|
||||
switch (instance.getDriverType()) {
|
||||
case H2_EMBEDDED:
|
||||
case DERBY_EMBEDDED:
|
||||
case MARIADB_10_1:
|
||||
case MYSQL_5_7:
|
||||
case COCKROACHDB_21_1:
|
||||
break;
|
||||
case POSTGRES_9_4:
|
||||
case MSSQL_2012:
|
||||
case ORACLE_12C:
|
||||
/*
|
||||
* This is a hardcoded fix to remove the FK constraint from FK_RES_LINK to the
|
||||
* target resource. This constraint hurts performance so we drop it on several
|
||||
* platforms, but we want to leave it in for H2 so that unit tests can catch
|
||||
* issues.
|
||||
*
|
||||
* In the future it may be possible to do this in a cleaner way, but for now
|
||||
* we have to leave the constraint as-is in the entity classes because of this
|
||||
* bug:
|
||||
* https://hibernate.atlassian.net/browse/HHH-19046
|
||||
*/
|
||||
if (nextDialect.getDropStatementsContainingRegex() == null) {
|
||||
nextDialect.setDropStatementsContainingRegex(new ArrayList<>());
|
||||
}
|
||||
nextDialect.dropStatementsContainingRegex.add("add constraint FK_RESLINK_TARGET");
|
||||
break;
|
||||
}
|
||||
|
||||
generator.addDialect(nextDialect);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue