ARTICLE AD BOX
I configured my spring application to interact with flyway for a data migration but flyway seems not to be working. My application.properties file is in the resources package
spring.application.name=com.codefinity.firstrestapiooks spring.flyway.url=jdbc:mysql://localhost:3306/my_database spring.flyway.user=root spring.flyway.password=1234 spring.datasource.url=jdbc:mysql://localhost:3306/my_database spring.datasource.username=root spring.datasource.password=1234 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.flyway.locations=classpath:db/migrationmy pom.xml has all the correct dependencies
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>4.0.6</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>org.codefinity</groupId> <artifactId>first-rest-api-books</artifactId> <version>0.0.1-SNAPSHOT</version> <name>com.codefinity.firstrestapiooks</name> <description>com.codefinity.firstrestapiooks</description> <url/> <licenses> <license/> </licenses> <developers> <developer/> </developers> <scm> <connection/> <developerConnection/> <tag/> <url/> </scm> <properties> <java.version>25</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webmvc</artifactId> <version>4.1.0-RC1</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>3.0.3</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> <version>4.1.0-RC1</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-webmvc-test</artifactId> <version>4.1.0-RC1</version> <scope>test</scope> </dependency> <dependency> <groupId>com.mysql</groupId> <artifactId>mysql-connector-j</artifactId> <version>9.7.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.modelmapper</groupId> <artifactId>modelmapper</artifactId> <version>3.2.6</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-mysql</artifactId> <version>12.4.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.flywaydb</groupId> <artifactId>flyway-core</artifactId> <version>12.4.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.46</version> <scope>compile</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>and my table .sql file is in the package db.migration. It is named v1__create_table_books.sql
CREATE TABLE books ( id VARCHAR(255) PRIMARY KEY, name VARCHAR(255) NOT NULL, author VARCHAR(255), price DECIMAL(10, 2) );So I do not know why it is not creating the table if everything is correct.
New contributor
Gnome is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
Explore related questions
See similar questions with these tags.
