Skip to content

Commit 2fdab3c

Browse files
fix: update SQL syntax for H2 2.x compatibility
H2 2.x (managed by Spring Boot 2.7.18) removed support for the non-standard 'DROP TABLE <table> IF EXISTS' syntax and the SERIAL pseudo-type. Updated to standard SQL: - DROP TABLE IF EXISTS customers - id INT AUTO_INCREMENT PRIMARY KEY Co-Authored-By: Lukas Burger <lukas.burger@cognition.ai>
1 parent 95cd0a8 commit 2fdab3c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/java/hello/Application.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public CommandLineRunner run(RestTemplate restTemplate) throws Exception {
6363
public void run(String... args) throws Exception {
6464
log.info("Creating tables");
6565

66-
jdbcTemplate.execute("DROP TABLE customers IF EXISTS");
67-
jdbcTemplate.execute("CREATE TABLE customers(id SERIAL, first_name VARCHAR(255), last_name VARCHAR(255))");
66+
jdbcTemplate.execute("DROP TABLE IF EXISTS customers");
67+
jdbcTemplate.execute("CREATE TABLE customers(id INT AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(255), last_name VARCHAR(255))");
6868

6969
// Split up the array of whole names into an array of first/last names
7070
List<Object[]> splitUpNames = Arrays.asList("John Woo", "Jeff Dean", "Josh Bloch", "Josh Long")

0 commit comments

Comments
 (0)