com.brihaspathee.zeus.config.CleanDB Maven / Gradle / Ivy
package com.brihaspathee.zeus.config;
import org.springframework.boot.autoconfigure.flyway.FlywayMigrationStrategy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
/**
* Created in Intellij IDEA
* User: Balaji Varadharajan
* Date: 04, March 2022
* Time: 4:45 PM
* Project: Zeus
* Package Name: com.brihaspathee.zeus.config
* To change this template use File | Settings | File and Code Template
*/
@Configuration
@Profile("clean")
public class CleanDB {
/**
* The method will clean the DB on startup
* @return
*/
@Bean
public FlywayMigrationStrategy clean(){
return flyway -> {
flyway.clean();
flyway.migrate();
};
}
}