Skip to content
Snippets Groups Projects
Commit e0274814 authored by Martin Weise's avatar Martin Weise
Browse files

Hotfix deletion of views

parent fd382967
Branches
Tags
7 merge requests!345Updated docs and endpoints:,!341Fixed mapping problem where UK and FK share columns they are inserted,!339Fixed mapping problem where UK and FK share columns they are inserted,!338Fixed mapping problem where UK and FK share columns they are inserted,!334Fixed mapping problem where UK and FK share columns they are inserted,!333Fixed mapping problem where UK and FK share columns they are inserted,!331Hotfix deletion of views
......@@ -369,7 +369,7 @@ CREATE TABLE IF NOT EXISTS `mdb_view_columns`
d BIGINT UNSIGNED,
is_null_allowed BOOLEAN NOT NULL DEFAULT true,
PRIMARY KEY (id),
FOREIGN KEY (view_id) REFERENCES mdb_view (id),
FOREIGN KEY (view_id) REFERENCES mdb_view (id) ON DELETE CASCADE,
UNIQUE (view_id, internal_name)
) WITH SYSTEM VERSIONING;
......
......@@ -12,6 +12,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@ToString
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@EntityListeners(AuditingEntityListener.class)
@jakarta.persistence.Table(name = "mdb_view_columns", uniqueConstraints = {
@UniqueConstraint(columnNames = {"view_id", "internal_name"})
......
......@@ -25,6 +25,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
......@@ -92,6 +93,9 @@ public class ViewServicePersistenceTest extends AbstractUnitTest {
/* test */
viewService.delete(VIEW_1);
assertThrows(ViewNotFoundException.class, () -> {
viewService.findById(DATABASE_1, VIEW_1_ID);
});
}
}
......@@ -214,7 +214,7 @@ public class DataServiceGatewayImpl implements DataServiceGateway {
public ViewDto createView(Long databaseId, ViewCreateDto data) throws DataServiceConnectionException, DataServiceException {
final ResponseEntity<ViewDto> response;
final String path = "/api/database/" + databaseId + "/view";
log.trace("delete table at endpoint {} with path {}", gatewayConfig.getDataEndpoint(), path);
log.trace("create view at endpoint {} with path {}", gatewayConfig.getDataEndpoint(), path);
try {
response = restTemplate.exchange(path, HttpMethod.POST, new HttpEntity<>(data), ViewDto.class);
} catch (HttpServerErrorException e) {
......@@ -264,6 +264,7 @@ public class DataServiceGatewayImpl implements DataServiceGateway {
QueryNotFoundException {
final ResponseEntity<QueryDto> response;
final String path = "/api/database/" + databaseId + "/subset/" + queryId;
log.trace("find subset at endpoint {} with path {}", gatewayConfig.getDataEndpoint(), path);
try {
response = restTemplate.exchange(path, HttpMethod.GET, HttpEntity.EMPTY, QueryDto.class);
} catch (HttpServerErrorException e) {
......@@ -291,6 +292,7 @@ public class DataServiceGatewayImpl implements DataServiceGateway {
DataServiceException, QueryNotFoundException {
final ResponseEntity<ExportResourceDto> response;
final String path = "/api/database/" + databaseId + "/subset/" + queryId;
log.trace("export subset at endpoint {} with path {}", gatewayConfig.getDataEndpoint(), path);
try {
response = restTemplate.exchange(path, HttpMethod.GET, HttpEntity.EMPTY, ExportResourceDto.class);
} catch (HttpServerErrorException e) {
......@@ -315,6 +317,7 @@ public class DataServiceGatewayImpl implements DataServiceGateway {
TableNotFoundException {
final ResponseEntity<TableDto[]> response;
final String path = "/api/database/" + databaseId + "/table";
log.trace("get table schemas at endpoint {} with path {}", gatewayConfig.getDataEndpoint(), path);
try {
response = restTemplate.exchange(path, HttpMethod.GET, HttpEntity.EMPTY, TableDto[].class);
} catch (HttpServerErrorException e) {
......
......@@ -11,7 +11,7 @@
prepend-icon="mdi-plus"
variant="flat"
:text="$t('toolbars.database.create.text')"
color="primary"
color="secondary"
@click.stop="dialog = true" />
</v-toolbar>
<DatabaseList
......
......@@ -10,7 +10,7 @@
v-if="canCreateDatabase"
class="mr-4"
prepend-icon="mdi-plus"
color="primary"
color="secondary"
variant="flat"
@click.stop="createDbDialog = true">
{{ $t('toolbars.database.create.text') }}
......
......@@ -1292,7 +1292,7 @@
{
"matcher": {
"id": "byName",
"options": "auth-service:8080"
"options": "auth-service:9000"
},
"properties": [
{
......@@ -1442,10 +1442,6 @@
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
......@@ -1455,7 +1451,7 @@
{
"matcher": {
"id": "byName",
"options": "auth-service:8080"
"options": "auth-service:9000"
},
"properties": [
{
......@@ -1803,7 +1799,7 @@
"type": "timeseries"
}
],
"refresh": "5s",
"refresh": "1m",
"schemaVersion": 39,
"tags": [
"provisioned",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment