flyway failes to insert installed_on timestamp when running a migration

linde98linde98 Posts: 2 New member
edited August 6, 2024 12:06PM in Flyway (General Discussion)
###### Which version and edition of Flyway are you using?
10.16.0

###### Which client are you using? 
Java API

###### Which database are you using? (Type & version)
mysql  Ver 8.0.37 (MySQL Community Server - GPL)

###### Which operating system are you using?
Linux x86_64 

###### What did you do? 

I have a program which applies migration running within a CI. No special configuration settings or otherwise are used.  

```kotlin
val config = Configuration.loadConfiguration()
val flyway = Flyway.configure()
    .dataSource(config.jdbcUrl, config.username, config.password)
    .schemas("myproject")
    .locations(config.migrationsPath)
    .load()
flyway.migrate()
```
###### What did you expect to see?
I expect that flyway terminates successfully while setting the correct `installed_on` timestamp in the `flyway_schema_history` table. 

###### What did you see instead?
The migrations are applied correctly however the insertion of the `installed_on` field in the `flyway_schema_history` fails. The rest of the fields in the table are set correctly. This exception occurs:

```
Error: Exception in thread "main" java.lang.IllegalArgumentException: null string

at java.sql/java.sql.Timestamp.valueOf(Timestamp.java:190)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lambda$refreshCache$1(JdbcTableSchemaHistory.java:2[31](https://github.com/My-Project/DataImport-Migrations/actions/runs/10029633569/job/27718076662#step:4:32))
at org.flywaydb.core.internal.jdbc.JdbcTemplate.query(JdbcTemplate.java:359)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.refreshCache(JdbcTableSchemaHistory.java:207)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.allAppliedMigrations(JdbcTableSchemaHistory.java:198)
at org.flywaydb.core.internal.info.MigrationInfoServiceImpl.refresh(MigrationInfoServiceImpl.java:87)
at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:176)
at org.flywaydb.core.internal.command.DbMigrate.lambda$migrateAll$0(DbMigrate.java:146)
at org.flywaydb.database.mysql.MySQLNamedLockTemplate.execute(MySQLNamedLockTemplate.java:62)
at org.flywaydb.database.mysql.MySQLConnection.lock(MySQLConnection.java:154)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:149)
at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:146)
at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:104)
at org.flywaydb.core.Flyway.lambda$migrate$0(Flyway.java:222)
at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:210)
at org.flywaydb.core.Flyway.migrate(Flyway.java:164)
at my.project.dataImporter.migrations.DataImportMigrations.runMigrations(DataImportMigrations.kt:27)
at my.project.dataImporter.migrations.DataImportMigrationsKt.main(DataImportMigrations.kt:[34]
> Task :app:run FAILED
``` 

Furthermore this issue did not occur in the beginning. It just randomly started.

Answers

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file