GH-836 - Add support for MariaDB database.
This commit is contained in:
committed by
Oliver Drotbohm
parent
0c2f79a56d
commit
e0b79e5fb1
@@ -104,6 +104,12 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>mariadb</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testcontainers</groupId>
|
||||
<artifactId>mssqlserver</artifactId>
|
||||
@@ -140,6 +146,12 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mariadb.jdbc</groupId>
|
||||
<artifactId>mariadb-java-client</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -50,6 +50,24 @@ enum DatabaseType {
|
||||
}
|
||||
},
|
||||
|
||||
MARIADB("mariadb", "MariaDB") {
|
||||
|
||||
@Override
|
||||
Object uuidToDatabase(UUID id) {
|
||||
return id.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
UUID databaseToUUID(Object id) {
|
||||
return UUID.fromString(id.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isSchemaSupported() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
POSTGRES("postgresql", "PostgreSQL"),
|
||||
|
||||
MSSQL("sqlserver", "Microsoft SQL Server") {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
CREATE TABLE IF NOT EXISTS EVENT_PUBLICATION
|
||||
(
|
||||
ID VARCHAR(36) NOT NULL,
|
||||
LISTENER_ID VARCHAR(512) NOT NULL,
|
||||
EVENT_TYPE VARCHAR(512) NOT NULL,
|
||||
SERIALIZED_EVENT VARCHAR(4000) NOT NULL,
|
||||
PUBLICATION_DATE TIMESTAMP(6) NOT NULL,
|
||||
COMPLETION_DATE TIMESTAMP(6) DEFAULT NULL NULL,
|
||||
PRIMARY KEY (ID),
|
||||
INDEX EVENT_PUBLICATION_BY_COMPLETION_DATE_IDX (COMPLETION_DATE)
|
||||
);
|
||||
@@ -123,6 +123,10 @@ class DatabaseSchemaInitializerIntegrationTests {
|
||||
@ActiveProfiles("mysql")
|
||||
class MySQL extends WithInitEnabled {}
|
||||
|
||||
@Nested
|
||||
@ActiveProfiles("mariadb")
|
||||
class MariaDB extends WithInitEnabled {}
|
||||
|
||||
@Nested
|
||||
@ActiveProfiles("mssql")
|
||||
class MSSQL extends WithInitEnabled {}
|
||||
|
||||
@@ -47,6 +47,13 @@ class DatabaseSchemaInitializerUnitTests {
|
||||
assertThatIllegalStateException().isThrownBy(() -> createInitializer(withSchema(schema), DatabaseType.MYSQL));
|
||||
}
|
||||
|
||||
// GH-836
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = { "", "test" })
|
||||
void rejectsExplicitSchemaNameForMariDB(String schema) {
|
||||
assertThatIllegalStateException().isThrownBy(() -> createInitializer(withSchema(schema), DatabaseType.MARIADB));
|
||||
}
|
||||
|
||||
// GH-804
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = { "", "test" })
|
||||
|
||||
@@ -469,6 +469,14 @@ class JdbcEventPublicationRepositoryIntegrationTests {
|
||||
@WithMySql
|
||||
class MysqlWithDeleteCompletion extends WithDeleteCompletion {}
|
||||
|
||||
// MariaDB
|
||||
|
||||
@WithMariaDB
|
||||
class MariaDBWithNoDefinedSchemaName extends WithNoDefinedSchemaName {}
|
||||
|
||||
@WithMariaDB
|
||||
class MariaDBWithDeleteCompletion extends WithDeleteCompletion {}
|
||||
|
||||
@Value
|
||||
private static final class TestEvent {
|
||||
String eventId;
|
||||
@@ -493,6 +501,11 @@ class JdbcEventPublicationRepositoryIntegrationTests {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface WithMySql {}
|
||||
|
||||
@Nested
|
||||
@ActiveProfiles("mariadb")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface WithMariaDB {}
|
||||
|
||||
@Nested
|
||||
@ActiveProfiles("postgres")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
spring.datasource.url=jdbc:tc:mariadb:11.5.2:///events
|
||||
spring.datasource.driverClassName=org.testcontainers.jdbc.ContainerDatabaseDriver
|
||||
@@ -203,6 +203,14 @@ include::{jdbc-schema-base}/schema-hsqldb.sql[]
|
||||
include::{jdbc-schema-base}/schema-mysql.sql[]
|
||||
----
|
||||
|
||||
[[schemas.mariadb]]
|
||||
=== MariaDB
|
||||
|
||||
[source, sql]
|
||||
----
|
||||
include::{jdbc-schema-base}/schema-mariadb.sql[]
|
||||
----
|
||||
|
||||
[[schemas.postgresql]]
|
||||
=== PostgreSQL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user