package com.trade.common.config;

import liquibase.integration.spring.SpringLiquibase;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

//@Configuration
public class LiquibaseConfig {

    public static final String CHANGE_LOG_FILE = "classpath:/liquibase/master.xml";
    @Value("${spring.liquibase.enabled}")
    private boolean shouldRun;

    //@Bean
    public SpringLiquibase liquibase(DataSource dataSource) {
        SpringLiquibase liquibase = new SpringLiquibase();
        liquibase.setChangeLog(CHANGE_LOG_FILE);
        liquibase.setDataSource(dataSource);
        liquibase.setShouldRun(shouldRun);
        return liquibase;
    }
}
