From 5cdbf4df5c42691c7888b2c163714303c6f66f68 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Sat, 12 Oct 2024 22:47:40 +0200 Subject: [PATCH] Hotfix deletion of views Signed-off-by: Martin Weise <martin.weise@tuwien.ac.at> --- dbrepo-metadata-db/1_setup-schema.sql | 2 +- .../main/java/at/tuwien/entities/database/ViewColumn.java | 1 + .../java/at/tuwien/gateway/impl/DataServiceGatewayImpl.java | 5 ++++- dbrepo-ui/pages/index.vue | 2 +- dbrepo-ui/pages/search.vue | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dbrepo-metadata-db/1_setup-schema.sql b/dbrepo-metadata-db/1_setup-schema.sql index d52cb4cae8..b6b3b7bf89 100644 --- a/dbrepo-metadata-db/1_setup-schema.sql +++ b/dbrepo-metadata-db/1_setup-schema.sql @@ -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; diff --git a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/ViewColumn.java b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/ViewColumn.java index 5016630500..10ac29d8e6 100644 --- a/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/ViewColumn.java +++ b/dbrepo-metadata-service/entities/src/main/java/at/tuwien/entities/database/ViewColumn.java @@ -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"}) diff --git a/dbrepo-metadata-service/services/src/main/java/at/tuwien/gateway/impl/DataServiceGatewayImpl.java b/dbrepo-metadata-service/services/src/main/java/at/tuwien/gateway/impl/DataServiceGatewayImpl.java index 0c11de4429..709537862a 100644 --- a/dbrepo-metadata-service/services/src/main/java/at/tuwien/gateway/impl/DataServiceGatewayImpl.java +++ b/dbrepo-metadata-service/services/src/main/java/at/tuwien/gateway/impl/DataServiceGatewayImpl.java @@ -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) { diff --git a/dbrepo-ui/pages/index.vue b/dbrepo-ui/pages/index.vue index 93c48e1899..037f5b9410 100644 --- a/dbrepo-ui/pages/index.vue +++ b/dbrepo-ui/pages/index.vue @@ -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 diff --git a/dbrepo-ui/pages/search.vue b/dbrepo-ui/pages/search.vue index b2d0f02195..ebe16ecec1 100644 --- a/dbrepo-ui/pages/search.vue +++ b/dbrepo-ui/pages/search.vue @@ -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') }} -- GitLab