ru.foodtechlab.lib.auth.app.config.scheduler.RunMigrations Maven / Gradle / Ivy
The newest version!
package ru.foodtechlab.lib.auth.app.config.scheduler;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import ru.foodtechlab.lib.auth.service.domain.migration.config.MigrationConfig;
import ru.foodtechlab.lib.auth.service.domain.migration.usecases.InitMigrationUseCase;
import ru.foodtechlab.lib.auth.service.domain.migration.usecases.RunMigrationUseCase;
@Component
@RequiredArgsConstructor
public class RunMigrations {
private final MigrationConfig migrationConfig;
@EventListener(ApplicationReadyEvent.class)
public void start(){
migrationConfig.initMigrationUseCase().execute(InitMigrationUseCase.InputValues.of());
migrationConfig.runMigrationUseCase().execute(RunMigrationUseCase.InputValues.of());
}
}