Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5245538

Browse files
committed
Flyway
1 parent 6fda2da commit 5245538

File tree

8 files changed

+17
-20
lines changed

8 files changed

+17
-20
lines changed

‎spring-jpa-flyway/pom.xml‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
<description>Demo project for Spring Boot</description>
1616
<properties>
1717
<java.version>17</java.version>
18-
<database.url>jdbc:mysql://localhost:3306/flyway_demo</database.url>
19-
<database.username>YOUR_DB_USER</database.username>
20-
<database.password>YOUR_DB_PASSWORD</database.password>
18+
<database.username>YOUR_TEST_USERNAME</database.username>
19+
<database.password>YOUR_TEST_PASSWORD</database.password>
2120
</properties>
2221
<dependencies>
2322
<dependency>
@@ -38,20 +37,21 @@
3837
<artifactId>lombok</artifactId>
3938
<optional>true</optional>
4039
</dependency>
41-
<dependency>
42-
<groupId>org.springframework.boot</groupId>
43-
<artifactId>spring-boot-starter-test</artifactId>
44-
<scope>test</scope>
45-
</dependency>
40+
4641
<dependency>
4742
<groupId>org.flywaydb</groupId>
4843
<artifactId>flyway-core</artifactId>
49-
<version>10.11.0</version>
44+
<version>10.11.1</version>
5045
</dependency>
5146
<dependency>
5247
<groupId>org.flywaydb</groupId>
5348
<artifactId>flyway-mysql</artifactId>
54-
<version>10.11.0</version>
49+
<version>10.11.1</version>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.springframework.boot</groupId>
53+
<artifactId>spring-boot-starter-test</artifactId>
54+
<scope>test</scope>
5555
</dependency>
5656
</dependencies>
5757

@@ -62,9 +62,10 @@
6262
<artifactId>flyway-maven-plugin</artifactId>
6363
<version>10.10.0</version>
6464
<configuration>
65-
<url>${database.url}</url>
65+
<url>jdbc:mysql://localhost:3306/flyway_demo</url>
6666
<user>${database.username}</user>
6767
<password>${database.password}</password>
68+
<locations>classpath:db/migrations</locations>
6869
</configuration>
6970
</plugin>
7071

@@ -82,5 +83,4 @@
8283
</plugin>
8384
</plugins>
8485
</build>
85-
8686
</project>

‎spring-jpa-flyway/src/main/java/com/stacktips/app/repository/MovieRepository.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
@Repository
88
public interface MovieRepository extends JpaRepository<Movie, Long> {
99

10-
}
10+
}

‎spring-jpa-flyway/src/main/resources/application.properties‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ spring.datasource.password=Passw0rd
77
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
88

99
#JPA
10-
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
1110
spring.jpa.show-sql=true
1211

13-
# Flyway
1412
spring.flyway.enabled=true
15-
spring.flyway.locations=classpath:db/migration
16-
spring.flyway.baseline-on-migrate=false
17-
spring.flyway.validate-on-migrate=false
13+
spring.flyway.locations=classpath:db/migrations
14+
spring.flyway.baseline-on-migrate=true
15+
spring.flyway.validate-on-migrate=true
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎spring-jpa-flyway/src/main/resources/db/migration/V4__insert_test_movie_data.sql‎ renamed to ‎spring-jpa-flyway/src/main/resources/db/migrations/V4__insert_test_data.sql‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
-- Inserting data into the 'movie' table
21
INSERT INTO movie (title, headline, language, region, thumbnail, rating)
32
VALUES ('Inception', 'A thief who steals corporate secrets through the use of dream-sharing technology.', 'English',
43
'USA', 'inception.jpg', 'PG13'),
@@ -33,4 +32,4 @@ VALUES (3, 3);
3332

3433
-- Audrey Tautou in Amélie
3534
INSERT INTO movie_actors (actors_id, movie_id)
36-
VALUES (4, 4);
35+
VALUES (4, 4);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /