From 94e8ba7ba52faf42cc54909999fe28e56fe6cdab Mon Sep 17 00:00:00 2001 From: Vlad Mihalcea Date: Tue, 27 Mar 2018 18:14:43 +0300 Subject: [PATCH] HHH-11806 - Add support for MariaDB 10.3 HHH-11769 - New MariaDB Dialect for MariaDB >= v10.1 Add support for IF EXISTS in constraint clauses --- .../main/java/org/hibernate/dialect/MariaDB10Dialect.java | 5 +++++ .../test/schemaupdate/foreignkeys/ForeignKeyDropTest.java | 4 ++-- .../src/main/java/org/hibernate/testing/DialectChecks.java | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB10Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB10Dialect.java index ea63fc2bcc..11028b68ea 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB10Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/MariaDB10Dialect.java @@ -21,4 +21,9 @@ public class MariaDB10Dialect extends MariaDB53Dialect { registerFunction( "to_base64", new StandardSQLFunction( "to_base64", StandardBasicTypes.STRING ) ); registerFunction( "from_base64", new StandardSQLFunction( "from_base64", StandardBasicTypes.STRING ) ); } + + @Override + public boolean supportsIfExistsBeforeConstraintName() { + return true; + } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/foreignkeys/ForeignKeyDropTest.java b/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/foreignkeys/ForeignKeyDropTest.java index 2e75d3733d..237432ad77 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/foreignkeys/ForeignKeyDropTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/foreignkeys/ForeignKeyDropTest.java @@ -45,7 +45,7 @@ import static org.junit.Assert.assertThat; * @author Andrea Boriero */ @TestForIssue(jiraKey = "HHH-12271") -@RequiresDialectFeature(DialectChecks.SupportDropCOnstraints.class) +@RequiresDialectFeature(DialectChecks.SupportDropConstraints.class) public class ForeignKeyDropTest extends BaseUnitTestCase { private File output; private MetadataImplementor metadata; @@ -71,7 +71,7 @@ public class ForeignKeyDropTest extends BaseUnitTestCase { @Test @TestForIssue(jiraKey = "HHH-11236") - public void testForeignKeyDropIsCOrrectlyGenerated() throws Exception { + public void testForeignKeyDropIsCorrectlyGenerated() throws Exception { schemaExport .drop( EnumSet.of( TargetType.SCRIPT, TargetType.DATABASE ), metadata ); diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java b/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java index 7905e6d8a5..a49fdd5f9b 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java @@ -230,7 +230,7 @@ abstract public class DialectChecks { } } - public static class SupportDropCOnstraints implements DialectCheck { + public static class SupportDropConstraints implements DialectCheck { public boolean isMatch(Dialect dialect) { return dialect.dropConstraints(); }