Skip to content

Commit

Permalink
add is_multi_node column
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonEntholzer committed Oct 10, 2024
1 parent 5704f42 commit 34b8a1c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public class Telemetry extends DomainObject {
@Column(name = "is_test_server")
private boolean isTestServer;

@Column(name = "is_multi_node")
private boolean isMultiNode;

@Column(name = "datasource")
private String dataSource;

Expand Down Expand Up @@ -141,4 +144,12 @@ public boolean isTestServer() {
public void setTestServer(boolean testServer) {
isTestServer = testServer;
}

public boolean isMultiNode() {
return isMultiNode;
}

public void setMultiNode(boolean multiNode) {
isMultiNode = multiNode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,25 @@

@JsonInclude(JsonInclude.Include.NON_EMPTY)
public record TelemetryDTO(Long id, String version, String serverUrl, String operator, String adminName, List<String> profiles, String contact, ZonedDateTime timestamp,
boolean isProductionInstance, boolean isTestServer, String dataSource, int numberOfNodes, int buildAgentCount) {
boolean isProductionInstance, boolean isTestServer, boolean isMultiNode, String dataSource, int numberOfNodes, int buildAgentCount) {

public static TelemetryDTO from(Telemetry telemetry) {
List<String> profilesList = List.of(telemetry.getProfiles().split(","));
return new TelemetryDTO(telemetry.getId(), telemetry.getVersion(), telemetry.getServerUrl(), telemetry.getOperatorName(), telemetry.getAdminName(), profilesList, telemetry.getContact(), telemetry.getTimestamp(),
telemetry.isProductionInstance(), telemetry.isTestServer(), telemetry.getDataSource(), telemetry.getNumberOfNodes(), telemetry.getBuildAgentCount());
return new TelemetryDTO(
telemetry.getId(),
telemetry.getVersion(),
telemetry.getServerUrl(),
telemetry.getOperatorName(),
telemetry.getAdminName(),
profilesList,
telemetry.getContact(),
telemetry.getTimestamp(),
telemetry.isProductionInstance(),
telemetry.isTestServer(),
telemetry.isMultiNode(),
telemetry.getDataSource(),
telemetry.getNumberOfNodes(),
telemetry.getBuildAgentCount());
}

public static Telemetry to(TelemetryDTO telemetryDTO) {
Expand All @@ -28,6 +41,7 @@ public static Telemetry to(TelemetryDTO telemetryDTO) {
telemetry.setTimestamp(telemetryDTO.timestamp());
telemetry.setContact(telemetryDTO.contact());
telemetry.setProductionInstance(telemetryDTO.isProductionInstance());
telemetry.setTestServer(telemetryDTO.isMultiNode());
telemetry.setDataSource(telemetryDTO.dataSource());
telemetry.setNumberOfNodes(telemetryDTO.numberOfNodes());
telemetry.setBuildAgentCount(telemetryDTO.buildAgentCount());
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/db/changelog/20241010210000.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet id="20241001210000_1" author="entholzer">
<addColumn tableName="telemetry">
<column name="is_multi_node" type="boolean" defaultValue="false"/>
</addColumn>
</changeSet>
</databaseChangeLog>
1 change: 1 addition & 0 deletions src/main/resources/db/changelog/db.changelog-master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
<include file="classpath:db/changelog/initial-schema.xml"/>
<include file="classpath:db/changelog/20240929130000.xml"/>
<include file="classpath:db/changelog/20241001210000.xml"/>
<include file="classpath:db/changelog/20241010210000.xml"/>
</databaseChangeLog>

0 comments on commit 34b8a1c

Please sign in to comment.