Flyway on AWS lambda doesn't execute the sql script inside migration folder.
nghiabv120100
Posts: 1 New member
I plain to write code Flyway on the lambda function and invoke it from github actions. But It seem Flyway doesn't execute my SQL script on the lambda Environment although it can execute SQL script on the Local.
My Java code:
I tested it on the local and it works well.
But when I deploy on the AWS Lambda, I invoke the AWS lambda function, it just creates table `flyway_schema_history` without run script inside folder `db/migration`. (I already drop and re-create database).
- My tech use.
+ AWS Lambda
+ Java 21
+ Aurora Mysql 8.0
+ Maven
+ flyway-mysql: 10.11.1
Could you help me investigate it?
Thank you so much!!
My Java code:
public class FlywayHandler {
private final String endpoint = System.getenv("ENDPOINT");
private final String jdbcUsername = System.getenv("USERNAME");
private final String jdbcPassword = System.getenv("PASSWORD");
private final String jdbcUrl = "jdbc:mysql://" + endpoint + ":3306/test_3";
public void handleRequest() {
Flyway flyway = Flyway.configure()
.locations("db/migration")
.dataSource(jdbcUrl, jdbcUsername, jdbcPassword)
.load();
flyway.migrate();
}
}
I tested it on the local and it works well.
But when I deploy on the AWS Lambda, I invoke the AWS lambda function, it just creates table `flyway_schema_history` without run script inside folder `db/migration`. (I already drop and re-create database).
- My tech use.
+ AWS Lambda
+ Java 21
+ Aurora Mysql 8.0
+ Maven
+ flyway-mysql: 10.11.1
Could you help me investigate it?
Thank you so much!!
Tagged:
Answers