#3735·flyway

mariadb reports error when changing field position

Author: HaonanQiuCreated Aug 30, 2023Updated Sep 22, 2026
Labelss: needs investigation
Which version and edition of Flyway are you using?

flyway-mysql:9.21.2

If this is not the latest version, can you reproduce the issue with the latest one as well? (Many bugs are fixed in newer releases and upgrading will often resolve the issue)

No, and I tried using version 8.5.13 and still have this problem

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Maven plugin

Which database are you using? (Type & version)

mariadb:10.9.8 mariadb-java-client:3.1.4

Which operating system are you using?

windows10

What did you do? (Please include the content causing the issue, any relevant configuration settings, the SQL statement(s) that failed (if any), and the command you ran)

When using flyway in springboot, other sql statements can be executed normally. Only when running to this line will an error be reported and the mariadb service will be stopped directly.

sql
alter table sys_item_stylist
    modify stylist_id bigint unsigned default 0 not null comment 'stylist_id' after item_id;

The main thing is to move the stylist_id field behind the item_id

What did you expect to see?

all the best

What did you see instead?

2023-08-30 13:41:25.375 WARN 9928 --- [ main] com.zaxxer.hikari.pool.ProxyConnection : HikariPool-1 - Connection org.mariadb.jdbc.Connection@23afc725 marked as broken because of SQLSTATE(08000), ErrorCode(-1) Caused by: java.io.EOFException: unexpected end of stream, read 0 bytes from 4 (socket was closed by server) 2023-08-30 13:41:25.381 ERROR 9928 --- [ main] o.f.c.i.j.TransactionalExecutionTemplate : Unable to rollback transaction java.sql.SQLException: Connection is closed 2023-08-30 13:41:25.381 ERROR 9928 --- [ main] o.f.c.i.j.TransactionalExecutionTemplate : Unable to restore autocommit to original value for connection java.sql.SQLException: Connection is closed 2023-08-30 13:41:25.382 ERROR 9928 --- [ main] o.f.core.internal.command.DbMigrate : Migration of schema hairsalon to version "1.0.3 - 20230824 rename stylist item" failed! Please restore backups and roll back database and code! 2023-08-30 13:41:25.382 ERROR 9928 --- [ main] o.f.d.mysql.MySQLNamedLockTemplate : Unable to release MySQL named lock: Flyway--1071838082 java.sql.SQLException: Connection is closed 2023-08-30 13:41:25.384 WARN 9928 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Unable to restore connection to its original state

SQL State : null Error Code : 0 Message : Connection is closed