diff options
author | Vitaly Takmazov | 2022-12-16 23:24:01 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-12-16 23:30:52 +0300 |
commit | 32f09ccf94c8ee50444dafa7f468c6e53a1d75df (patch) | |
tree | 9e5461a93f6d18db14ae45d802d9b6df64cc43d1 | |
parent | a2fbac50db81649981f72c7ba1561f45146fcf9b (diff) |
flyway: trying to repair on migrate
-rw-r--r-- | src/main/java/com/juick/API.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/java/com/juick/API.java b/src/main/java/com/juick/API.java index 755e4fc4..077fc1bc 100644 --- a/src/main/java/com/juick/API.java +++ b/src/main/java/com/juick/API.java @@ -20,8 +20,10 @@ package com.juick; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy; import org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration; import org.springframework.cache.annotation.EnableCaching; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @SpringBootApplication @@ -29,6 +31,13 @@ import org.springframework.context.annotation.ComponentScan; @EnableCaching @ComponentScan(basePackages = {"com.juick.config", "com.juick.service", "com.juick.www"}) public class API { + @Bean + public FlywayMigrationStrategy cleanMigrateStrategy() { + return flyway -> { + flyway.repair(); + flyway.migrate(); + }; + } public static void main(String[] args) { SpringApplication.run(API.class, args); } |