#74 -- get time series tendency for rules

This commit is contained in:
Anton Romanov 2022-11-27 22:09:07 +04:00
parent 8cb6fdf082
commit 0be5e9c77c
13 changed files with 132 additions and 42 deletions

View File

@ -62,7 +62,8 @@ public class IndexService {
commits = gitRepositoryService.getCommits(repositoryUrl, branchName, commitsFrom, commitsTo, false); commits = gitRepositoryService.getCommits(repositoryUrl, branchName, commitsFrom, commitsTo, false);
} }
Integer repositoryId = gitRepository.getId(); Integer repositoryId = gitRepository.getId();
timeSeriesCreators.forEach(tsCreator -> tsCreator.addTimeSeries(repositoryId, branchName)); final Branch branchForSave = branch;
timeSeriesCreators.forEach(tsCreator -> tsCreator.addTimeSeries(repositoryId, branchForSave));
LOG.debug("Complete indexing {} branch", branchName); LOG.debug("Complete indexing {} branch", branchName);
} }
} }

View File

@ -0,0 +1,29 @@
package ru.ulstu.extractor.http;
import ru.ulstu.extractor.ts.model.TimeSeries;
public class SmoothingTimeSeries {
private JsonTimeSeries originalTimeSeries;
private String methodClassName;
public SmoothingTimeSeries(TimeSeries timeSeries) {
originalTimeSeries = new JsonTimeSeries(timeSeries);
this.methodClassName = "FTransform";
}
public JsonTimeSeries getOriginalTimeSeries() {
return originalTimeSeries;
}
public void setOriginalTimeSeries(JsonTimeSeries originalTimeSeries) {
this.originalTimeSeries = originalTimeSeries;
}
public String getMethodClassName() {
return methodClassName;
}
public void setMethodClassName(String methodClassName) {
this.methodClassName = methodClassName;
}
}

View File

@ -29,7 +29,7 @@ public class RecommendationController {
public String getRecommendations(Model model, @RequestParam Optional<Integer> branchId) { public String getRecommendations(Model model, @RequestParam Optional<Integer> branchId) {
model.addAttribute("branches", branchService.findAll()); model.addAttribute("branches", branchService.findAll());
if (branchId.isPresent()) { if (branchId.isPresent()) {
model.addAttribute("recommendations", fuzzyInferenceService.getRecommendations()); model.addAttribute("recommendations", fuzzyInferenceService.getRecommendations(branchId.get()));
model.addAttribute("filterBranchForm", new FilterBranchForm(branchId.get())); model.addAttribute("filterBranchForm", new FilterBranchForm(branchId.get()));
} else { } else {
model.addAttribute("filterBranchForm", new FilterBranchForm()); model.addAttribute("filterBranchForm", new FilterBranchForm());

View File

@ -10,7 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import ru.ulstu.extractor.rule.model.AddRuleForm; import ru.ulstu.extractor.rule.model.AddRuleForm;
import ru.ulstu.extractor.rule.service.AntecedentValueService; import ru.ulstu.extractor.rule.service.AntecedentValueService;
import ru.ulstu.extractor.rule.service.RuleService; import ru.ulstu.extractor.rule.service.DbRuleService;
import ru.ulstu.extractor.ts.service.TimeSeriesService; import ru.ulstu.extractor.ts.service.TimeSeriesService;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
@ -21,14 +21,14 @@ import static ru.ulstu.extractor.core.Route.LIST_RULE;
@Controller @Controller
@ApiIgnore @ApiIgnore
public class RuleController { public class RuleController {
private final RuleService ruleService; private final DbRuleService ruleService;
private final AntecedentValueService antecedentValueService; private final AntecedentValueService antecedentValueService;
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
public RuleController(RuleService ruleService, public RuleController(DbRuleService dbRuleService,
AntecedentValueService antecedentValueService, AntecedentValueService antecedentValueService,
TimeSeriesService timeSeriesService) { TimeSeriesService timeSeriesService) {
this.ruleService = ruleService; this.ruleService = dbRuleService;
this.antecedentValueService = antecedentValueService; this.antecedentValueService = antecedentValueService;
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
} }

View File

@ -10,14 +10,14 @@ import ru.ulstu.extractor.ts.service.TimeSeriesService;
import java.util.List; import java.util.List;
@Service @Service
public class RuleService { public class DbRuleService {
private final RuleRepository ruleRepository; private final RuleRepository ruleRepository;
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final AntecedentValueService antecedentValueService; private final AntecedentValueService antecedentValueService;
public RuleService(RuleRepository ruleRepository, public DbRuleService(RuleRepository ruleRepository,
TimeSeriesService timeSeriesService, TimeSeriesService timeSeriesService,
AntecedentValueService antecedentValueService) { AntecedentValueService antecedentValueService) {
this.ruleRepository = ruleRepository; this.ruleRepository = ruleRepository;
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.antecedentValueService = antecedentValueService; this.antecedentValueService = antecedentValueService;

View File

@ -12,8 +12,11 @@ import com.fuzzylite.term.Triangle;
import com.fuzzylite.variable.InputVariable; import com.fuzzylite.variable.InputVariable;
import com.fuzzylite.variable.OutputVariable; import com.fuzzylite.variable.OutputVariable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.rule.model.AntecedentValue; import ru.ulstu.extractor.rule.model.AntecedentValue;
import ru.ulstu.extractor.rule.model.DbRule; import ru.ulstu.extractor.rule.model.DbRule;
import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.service.TimeSeriesService;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -26,13 +29,19 @@ public class FuzzyInferenceService {
private final static String RULE_TEMPLATE = "if %s is %s and %s is %s then " private final static String RULE_TEMPLATE = "if %s is %s and %s is %s then "
+ OUTPUT_VARIABLE_NAME + OUTPUT_VARIABLE_NAME
+ " is %s"; + " is %s";
private final RuleService ruleService; private final DbRuleService ruleService;
private final AntecedentValueService antecedentValueService; private final AntecedentValueService antecedentValueService;
private final GitRepositoryService gitRepositoryService;
private final TimeSeriesService timeSeriesService;
public FuzzyInferenceService(RuleService ruleService, public FuzzyInferenceService(DbRuleService ruleService,
AntecedentValueService antecedentValueService) { AntecedentValueService antecedentValueService,
GitRepositoryService gitRepositoryService,
TimeSeriesService timeSeriesService) {
this.ruleService = ruleService; this.ruleService = ruleService;
this.antecedentValueService = antecedentValueService; this.antecedentValueService = antecedentValueService;
this.gitRepositoryService = gitRepositoryService;
this.timeSeriesService = timeSeriesService;
} }
public List<String> getRulesFromDb() { public List<String> getRulesFromDb() {
@ -96,13 +105,12 @@ public class FuzzyInferenceService {
return engine; return engine;
} }
public String getRecommendations() { public String getRecommendations(Integer branchId) {
List<TimeSeries> timeSeries = timeSeriesService.getByBranch(branchId);
Engine engine = getFuzzyEngine(); Engine engine = getFuzzyEngine();
List<AntecedentValue> antecedentValues = antecedentValueService.getList(); List<AntecedentValue> antecedentValues = antecedentValueService.getList();
Map<String, Double> variableValues = new HashMap<>(); Map<String, Double> variableValues = new HashMap<>();
timeSeries.forEach(ts -> variableValues.put(ts.getTimeSeriesType().name(), timeSeriesService.getLastTimeSeriesTendency(ts)));
variableValues.put("COMMITS", 0.0);
variableValues.put("AUTHORS", 0.0);
engine.addRuleBlock(getRuleBlock(engine, variableValues, antecedentValues)); engine.addRuleBlock(getRuleBlock(engine, variableValues, antecedentValues));
return getConsequent(engine, variableValues); return getConsequent(engine, variableValues);
} }
@ -120,6 +128,5 @@ public class FuzzyInferenceService {
return (outputVariable == null || Double.isNaN(outputVariable.getValue())) return (outputVariable == null || Double.isNaN(outputVariable.getValue()))
? "Нет рекомендаций" ? "Нет рекомендаций"
: outputVariable.highestMembership(outputVariable.getValue()).getSecond().getName(); : outputVariable.highestMembership(outputVariable.getValue()).getSecond().getName();
//return outputVariable == null ? "" : outputVariable.fuzzyOutputValue();
} }
} }

View File

@ -1,5 +1,6 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import ru.ulstu.extractor.branch.model.Branch;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.model.TimeSeriesValue; import ru.ulstu.extractor.ts.model.TimeSeriesValue;
@ -29,15 +30,15 @@ public abstract class AbstractTimeSeriesCreator {
* Сохранить извлеченные временные ряды * Сохранить извлеченные временные ряды
* *
* @param repositoryId * @param repositoryId
* @param branchName * @param branch
*/ */
public void addTimeSeries(Integer repositoryId, String branchName) { public void addTimeSeries(Integer repositoryId, Branch branch) {
// извлеченные временных рядов // извлеченные временных рядов
List<TimeSeries> timeSeries = getTimeSeries(repositoryId, branchName); List<TimeSeries> timeSeries = getTimeSeries(repositoryId, branch.getName());
// сгруппированные по временным интервалам точки временных рядов // сгруппированные по временным интервалам точки временных рядов
timeSeries.forEach(ts -> ts.setValues(mapTimeSeriesToInterval(getTimeSeriesService().getTimeSeriesInterval(), ts.getValues()))); timeSeries.forEach(ts -> ts.setValues(mapTimeSeriesToInterval(getTimeSeriesService().getTimeSeriesInterval(), ts.getValues())));
getTimeSeriesService().save(sortTimeSeries(timeSeries)); getTimeSeriesService().save(sortTimeSeries(timeSeries), branch);
} }
private List<TimeSeries> sortTimeSeries(List<TimeSeries> timeSeries) { private List<TimeSeries> sortTimeSeries(List<TimeSeries> timeSeries) {

View File

@ -1,7 +1,9 @@
package ru.ulstu.extractor.ts.creator; package ru.ulstu.extractor.ts.creator;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ru.ulstu.extractor.branch.service.BranchService;
import ru.ulstu.extractor.commit.service.CommitService; import ru.ulstu.extractor.commit.service.CommitService;
import ru.ulstu.extractor.gitrepository.model.GitRepository;
import ru.ulstu.extractor.gitrepository.service.GitRepositoryService; import ru.ulstu.extractor.gitrepository.service.GitRepositoryService;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
@ -17,24 +19,29 @@ public class CommitsTS extends AbstractTimeSeriesCreator {
private final TimeSeriesService timeSeriesService; private final TimeSeriesService timeSeriesService;
private final CommitService commitService; private final CommitService commitService;
private final GitRepositoryService gitRepositoryService; private final GitRepositoryService gitRepositoryService;
private final BranchService branchService;
public CommitsTS(TimeSeriesService timeSeriesService, public CommitsTS(TimeSeriesService timeSeriesService,
CommitService commitService, CommitService commitService,
GitRepositoryService gitRepositoryService) { GitRepositoryService gitRepositoryService,
BranchService branchService) {
this.timeSeriesService = timeSeriesService; this.timeSeriesService = timeSeriesService;
this.commitService = commitService; this.commitService = commitService;
this.gitRepositoryService = gitRepositoryService; this.gitRepositoryService = gitRepositoryService;
this.branchService = branchService;
} }
@Override @Override
public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) { public List<TimeSeries> getTimeSeries(Integer repositoryId, String branchName) {
GitRepository gitRepository = gitRepositoryService.findById(repositoryId);
//TODO: добавить постраничное чтение //TODO: добавить постраничное чтение
return Collections.singletonList( return Collections.singletonList(
new TimeSeries( new TimeSeries(
String.format("%s %s %s", String.format("%s %s %s",
gitRepositoryService.findById(repositoryId).getName(), gitRepository.getName(),
branchName, branchName,
getTimeSeriesType().getDescription()), getTimeSeriesType().getDescription()),
branchService.findByRepositoryAndName(gitRepository, branchName),
getTimeSeriesType(), getTimeSeriesType(),
commitService.findByRepositoryIdAndName(repositoryId, branchName) commitService.findByRepositoryIdAndName(repositoryId, branchName)
.stream() .stream()

View File

@ -2,6 +2,7 @@ package ru.ulstu.extractor.ts.model;
import org.hibernate.annotations.Fetch; import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode; import org.hibernate.annotations.FetchMode;
import ru.ulstu.extractor.branch.model.Branch;
import ru.ulstu.extractor.core.BaseEntity; import ru.ulstu.extractor.core.BaseEntity;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
@ -10,6 +11,7 @@ import javax.persistence.EnumType;
import javax.persistence.Enumerated; import javax.persistence.Enumerated;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -25,22 +27,21 @@ public class TimeSeries extends BaseEntity {
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private TimeSeriesType timeSeriesType; private TimeSeriesType timeSeriesType;
@ManyToOne
private Branch branch;
public TimeSeries() { public TimeSeries() {
} }
public TimeSeries(String name) { public TimeSeries(String name, Branch branch, TimeSeriesType timeSeriesType) {
this.name = name; this(name, branch, timeSeriesType, new ArrayList<>());
} }
public TimeSeries(String name, List<TimeSeriesValue> values) { public TimeSeries(String name, Branch branch, TimeSeriesType timeSeriesType, List<TimeSeriesValue> values) {
this.name = name;
this.values = values;
}
public TimeSeries(String name, TimeSeriesType timeSeriesType, List<TimeSeriesValue> values) {
this.name = name; this.name = name;
this.values = values; this.values = values;
this.timeSeriesType = timeSeriesType; this.timeSeriesType = timeSeriesType;
this.branch = branch;
} }
public String getName() { public String getName() {
@ -66,4 +67,12 @@ public class TimeSeries extends BaseEntity {
public void setTimeSeriesType(TimeSeriesType timeSeriesType) { public void setTimeSeriesType(TimeSeriesType timeSeriesType) {
this.timeSeriesType = timeSeriesType; this.timeSeriesType = timeSeriesType;
} }
public Branch getBranch() {
return branch;
}
public void setBranch(Branch branch) {
this.branch = branch;
}
} }

View File

@ -3,8 +3,11 @@ package ru.ulstu.extractor.ts.repository;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import java.util.List;
import java.util.Optional; import java.util.Optional;
public interface TimeSeriesRepository extends JpaRepository<TimeSeries, Integer> { public interface TimeSeriesRepository extends JpaRepository<TimeSeries, Integer> {
Optional<TimeSeries> findByName(String name); Optional<TimeSeries> findByName(String name);
List<TimeSeries> getTimeSeriesByBranchId(Integer branchId);
} }

View File

@ -9,8 +9,10 @@ import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import ru.ulstu.extractor.branch.model.Branch;
import ru.ulstu.extractor.http.HttpService; import ru.ulstu.extractor.http.HttpService;
import ru.ulstu.extractor.http.JsonTimeSeries; import ru.ulstu.extractor.http.JsonTimeSeries;
import ru.ulstu.extractor.http.SmoothingTimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeries; import ru.ulstu.extractor.ts.model.TimeSeries;
import ru.ulstu.extractor.ts.model.TimeSeriesType; import ru.ulstu.extractor.ts.model.TimeSeriesType;
import ru.ulstu.extractor.ts.model.TimeSeriesValue; import ru.ulstu.extractor.ts.model.TimeSeriesValue;
@ -31,7 +33,8 @@ public class TimeSeriesService {
private final TimeSeriesValueRepository timeSeriesValueRepository; private final TimeSeriesValueRepository timeSeriesValueRepository;
private final TimeSeriesDateMapper.TimeSeriesInterval timeSeriesInterval = TimeSeriesDateMapper.TimeSeriesInterval.HOUR; private final TimeSeriesDateMapper.TimeSeriesInterval timeSeriesInterval = TimeSeriesDateMapper.TimeSeriesInterval.HOUR;
private final HttpService httpService; private final HttpService httpService;
private final static String TIME_SERIES_SERVICE_URL = "http://time-series.athene.tech/api/1.0/add-time-series?setKey=git-extractor"; private final static String TIME_SERIES_SAVE_SERVICE_URL = "http://time-series.athene.tech/api/1.0/add-time-series?setKey=git-extractor";
private final static String TIME_SERIES_TENDENCY_URL = "http://time-series.athene.tech/api/1.0/add-time-series?setKey=git-extractor";
public TimeSeriesService(TimeSeriesRepository timeSeriesRepository, public TimeSeriesService(TimeSeriesRepository timeSeriesRepository,
TimeSeriesValueRepository timeSeriesValueRepository, TimeSeriesValueRepository timeSeriesValueRepository,
@ -42,12 +45,11 @@ public class TimeSeriesService {
} }
@Transactional @Transactional
public TimeSeries save(String timeSeriesName, TimeSeriesType timeSeriesType, List<TimeSeriesValue> timeSeriesValues) { public TimeSeries save(String timeSeriesName, Branch branch, TimeSeriesType timeSeriesType, List<TimeSeriesValue> timeSeriesValues) {
LOG.debug("Start save {} time series with {} time series values ", timeSeriesName, timeSeriesValues.size()); LOG.debug("Start save {} time series with {} time series values ", timeSeriesName, timeSeriesValues.size());
final TimeSeries timeSeries = findOrCreate(timeSeriesName); final TimeSeries timeSeries = findOrCreate(timeSeriesName, branch, timeSeriesType);
List<TimeSeriesValue> timeSeriesValuesToRemove = timeSeries.getValues(); List<TimeSeriesValue> timeSeriesValuesToRemove = timeSeries.getValues();
timeSeries.setValues(timeSeriesValues); timeSeries.setValues(timeSeriesValues);
timeSeries.setTimeSeriesType(timeSeriesType);
LOG.debug("Save time series {} ", timeSeries.getName()); LOG.debug("Save time series {} ", timeSeries.getName());
TimeSeries savedTimeSeries = timeSeriesRepository.save(timeSeries); TimeSeries savedTimeSeries = timeSeriesRepository.save(timeSeries);
LOG.debug("Clear {} time series values ", timeSeriesValuesToRemove.size()); LOG.debug("Clear {} time series values ", timeSeriesValuesToRemove.size());
@ -56,13 +58,13 @@ public class TimeSeriesService {
return savedTimeSeries; return savedTimeSeries;
} }
public TimeSeries findOrCreate(String timeSeriesName) { public TimeSeries findOrCreate(String timeSeriesName, Branch branch, TimeSeriesType timeSeriesType) {
Optional<TimeSeries> maybeTimeSeries = timeSeriesRepository.findByName(timeSeriesName); Optional<TimeSeries> maybeTimeSeries = timeSeriesRepository.findByName(timeSeriesName);
if (maybeTimeSeries.isPresent()) { if (maybeTimeSeries.isPresent()) {
LOG.debug("TimeSeries {} exists.", maybeTimeSeries.get().getName()); LOG.debug("TimeSeries {} exists.", maybeTimeSeries.get().getName());
return maybeTimeSeries.get(); return maybeTimeSeries.get();
} }
return timeSeriesRepository.save(new TimeSeries(timeSeriesName)); return timeSeriesRepository.save(new TimeSeries(timeSeriesName, branch, timeSeriesType));
} }
/** /**
@ -72,10 +74,10 @@ public class TimeSeriesService {
* @return сохраненный список ВР * @return сохраненный список ВР
*/ */
@Transactional @Transactional
public List<TimeSeries> save(List<TimeSeries> timeSeries) { public List<TimeSeries> save(List<TimeSeries> timeSeries, Branch branch) {
List<TimeSeries> results = new ArrayList<>(); List<TimeSeries> results = new ArrayList<>();
for (TimeSeries ts : timeSeries) { for (TimeSeries ts : timeSeries) {
results.add(save(ts.getName(), ts.getTimeSeriesType(), ts.getValues())); results.add(save(ts.getName(), branch, ts.getTimeSeriesType(), ts.getValues()));
} }
return results; return results;
} }
@ -87,7 +89,7 @@ public class TimeSeriesService {
private void sendToTimeSeriesService(TimeSeries timeSeries) { private void sendToTimeSeriesService(TimeSeries timeSeries) {
new Thread(() -> { new Thread(() -> {
try { try {
httpService.post(TIME_SERIES_SERVICE_URL, new JSONObject(new JsonTimeSeries(timeSeries))); httpService.post(TIME_SERIES_SAVE_SERVICE_URL, new JSONObject(new JsonTimeSeries(timeSeries)));
LOG.debug("Успешно отправлен на сервис"); LOG.debug("Успешно отправлен на сервис");
} catch (Exception ex) { } catch (Exception ex) {
LOG.debug(ex.getMessage()); LOG.debug(ex.getMessage());
@ -107,4 +109,15 @@ public class TimeSeriesService {
public List<TimeSeriesType> getAllTimeSeriesTypes() { public List<TimeSeriesType> getAllTimeSeriesTypes() {
return Arrays.asList(TimeSeriesType.values()); return Arrays.asList(TimeSeriesType.values());
} }
public List<TimeSeries> getByBranch(Integer branchId) {
return timeSeriesRepository.getTimeSeriesByBranchId(branchId);
}
public Double getLastTimeSeriesTendency(TimeSeries ts) {
JSONObject response = httpService.post(TIME_SERIES_TENDENCY_URL, new JSONObject(new SmoothingTimeSeries(ts)));
LOG.debug("Успешно отправлен на сервис сглаживания");
response.get("timeSeries");
return 0.0;
}
} }

View File

@ -7,8 +7,9 @@ server.port=8080
server.jetty.connection-idle-timeout=1000s server.jetty.connection-idle-timeout=1000s
# Available levels are: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF # Available levels are: TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF
logging.level.ru.ulstu=DEBUG logging.level.ru.ulstu=DEBUG
logging.level.sun.rmi.transport.tcp=off logging.level.sun.rmi.transport=off
logging.level.javax.management.remote.rmi=off logging.level.javax.management.remote.rmi=off
logging.level.java.rmi.server=off
extractor.custom-projects-dir= extractor.custom-projects-dir=
# Thymeleaf Settings # Thymeleaf Settings
spring.thymeleaf.cache=false spring.thymeleaf.cache=false

View File

@ -80,4 +80,23 @@
<column name="antecedent_value" value="рост"/> <column name="antecedent_value" value="рост"/>
</insert> </insert>
</changeSet> </changeSet>
<changeSet author="orion" id="20221127-170000-1">
<addColumn tableName="time_series">
<column name="branch_id" type="integer"/>
</addColumn>
<addForeignKeyConstraint baseTableName="time_series" baseColumnNames="branch_id"
constraintName="fk_time_series_branch" referencedTableName="branch"
referencedColumnNames="id"/>
</changeSet>
<changeSet author="orion" id="20221127-170000-2">
<sql>
delete
from time_series_value
where time_series_id in (select id from time_series where time_series_type is null OR branch_id is null);
delete
from time_series
where time_series_type is null
OR branch_id is null;
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>