Skip to content

Commit 148bf33

Browse files
hpoettkerilayaperumalg
authored andcommitted
Add MySQL schema for SPRING_AI_CHAT_MEMORY
Signed-off-by: Henning Pöttker <25299532+hpoettker@users.noreply.github.com>
1 parent a0c76a0 commit 148bf33

File tree

5 files changed

+62
-2
lines changed

5 files changed

+62
-2
lines changed

memory/repository/spring-ai-model-chat-memory-repository-jdbc/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@
7373
<optional>true</optional>
7474
</dependency>
7575

76+
<dependency>
77+
<groupId>com.mysql</groupId>
78+
<artifactId>mysql-connector-j</artifactId>
79+
<version>${mysql.version}</version>
80+
<scope>test</scope>
81+
<optional>true</optional>
82+
</dependency>
83+
7684
<dependency>
7785
<groupId>com.microsoft.sqlserver</groupId>
7886
<artifactId>mssql-jdbc</artifactId>
@@ -104,6 +112,12 @@
104112
<scope>test</scope>
105113
</dependency>
106114

115+
<dependency>
116+
<groupId>org.testcontainers</groupId>
117+
<artifactId>mysql</artifactId>
118+
<scope>test</scope>
119+
</dependency>
120+
107121
<dependency>
108122
<groupId>org.testcontainers</groupId>
109123
<artifactId>mssqlserver</artifactId>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CREATE TABLE IF NOT EXISTS SPRING_AI_CHAT_MEMORY (
2+
`conversation_id` VARCHAR(36) NOT NULL,
3+
`content` TEXT NOT NULL,
4+
`type` ENUM('USER', 'ASSISTANT', 'SYSTEM', 'TOOL') NOT NULL,
5+
`timestamp` TIMESTAMP NOT NULL,
6+
7+
INDEX `SPRING_AI_CHAT_MEMORY_CONVERSATION_ID_TIMESTAMP_IDX` (`conversation_id`, `timestamp`)
8+
);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright 2023-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.ai.chat.memory.repository.jdbc;
18+
19+
import org.springframework.boot.test.context.SpringBootTest;
20+
import org.springframework.test.context.TestPropertySource;
21+
import org.springframework.test.context.jdbc.Sql;
22+
23+
/**
24+
* Integration tests for {@link JdbcChatMemoryRepository} with MariaDB.
25+
*
26+
* @author Jonathan Leijendekker
27+
* @author Thomas Vitale
28+
* @author Mark Pollack
29+
* @author Yanming Zhou
30+
*/
31+
@SpringBootTest
32+
@TestPropertySource(properties = { "spring.datasource.url=jdbc:tc:mariadb:10.3.39:///" })
33+
@Sql(scripts = "classpath:org/springframework/ai/chat/memory/repository/jdbc/schema-mariadb.sql")
34+
class JdbcChatMemoryRepositoryMariaDbIT extends AbstractJdbcChatMemoryRepositoryIT {
35+
36+
}

memory/repository/spring-ai-model-chat-memory-repository-jdbc/src/test/java/org/springframework/ai/chat/memory/repository/jdbc/JdbcChatMemoryRepositoryMysqlIT.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@
2727
* @author Thomas Vitale
2828
* @author Mark Pollack
2929
* @author Yanming Zhou
30+
* @author Henning Pöttker
3031
*/
3132
@SpringBootTest
32-
@TestPropertySource(properties = { "spring.datasource.url=jdbc:tc:mariadb:10.3.39:///" })
33-
@Sql(scripts = "classpath:org/springframework/ai/chat/memory/repository/jdbc/schema-mariadb.sql")
33+
@TestPropertySource(properties = { "spring.datasource.url=jdbc:tc:mysql:8.0.42:///" })
34+
@Sql(scripts = "classpath:org/springframework/ai/chat/memory/repository/jdbc/schema-mysql.sql")
3435
class JdbcChatMemoryRepositoryMysqlIT extends AbstractJdbcChatMemoryRepositoryIT {
3536

3637
}

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@
302302
<opensearch-client.version>2.23.0</opensearch-client.version>
303303
<postgresql.version>42.7.5</postgresql.version>
304304
<mariadb.version>3.5.3</mariadb.version>
305+
<mysql.version>9.2.0</mysql.version>
305306
<commonmark.version>0.22.0</commonmark.version>
306307

307308
<couchbase.version>3.8.0</couchbase.version>

0 commit comments

Comments
 (0)