diff --git a/backend/core/src/main/java/org/opencdmp/data/DescriptionEntity.java b/backend/core/src/main/java/org/opencdmp/data/DescriptionEntity.java index 4eee26ace..987d6e4fe 100644 --- a/backend/core/src/main/java/org/opencdmp/data/DescriptionEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/DescriptionEntity.java @@ -70,11 +70,11 @@ public class DescriptionEntity extends TenantScopedBaseEntity { public static final String _createdById = "createdById"; - @Column(name = "dmp_description_template", columnDefinition = "uuid", nullable = false) + @Column(name = "plan_description_template", columnDefinition = "uuid", nullable = false) private UUID planDescriptionTemplateId; public static final String _planDescriptionTemplateId = "planDescriptionTemplateId"; - @Column(name = "dmp", columnDefinition = "uuid", nullable = false) + @Column(name = "plan", columnDefinition = "uuid", nullable = false) private UUID planId; public static final String _planId = "planId"; diff --git a/backend/core/src/main/java/org/opencdmp/data/PlanBlueprintEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanBlueprintEntity.java index fd0cd835b..612fb012d 100644 --- a/backend/core/src/main/java/org/opencdmp/data/PlanBlueprintEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanBlueprintEntity.java @@ -1,21 +1,21 @@ package org.opencdmp.data; -import org.opencdmp.commons.enums.PlanBlueprintStatus; -import org.opencdmp.commons.enums.PlanBlueprintVersionStatus; -import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.converters.PlanBlueprintVersionStatusConverter; -import org.opencdmp.data.converters.enums.PlanBlueprintStatusConverter; -import org.opencdmp.data.converters.enums.IsActiveConverter; -import org.opencdmp.data.tenant.TenantScopedBaseEntity; -import org.opencdmp.data.types.SQLXMLType; import jakarta.persistence.*; import org.hibernate.annotations.Type; +import org.opencdmp.commons.enums.IsActive; +import org.opencdmp.commons.enums.PlanBlueprintStatus; +import org.opencdmp.commons.enums.PlanBlueprintVersionStatus; +import org.opencdmp.data.converters.PlanBlueprintVersionStatusConverter; +import org.opencdmp.data.converters.enums.IsActiveConverter; +import org.opencdmp.data.converters.enums.PlanBlueprintStatusConverter; +import org.opencdmp.data.tenant.TenantScopedBaseEntity; +import org.opencdmp.data.types.SQLXMLType; import java.time.Instant; import java.util.UUID; @Entity -@Table(name = "\"DmpBlueprint\"") +@Table(name = "\"PlanBlueprint\"") public class PlanBlueprintEntity extends TenantScopedBaseEntity { @Id @@ -31,7 +31,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { public static final int _labelLength = 250; - @Type(value = SQLXMLType.class) + @Type(SQLXMLType.class) @Column(name = "definition", columnDefinition = "xml") private String definition; @@ -60,7 +60,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { public static final String _versionStatus = "versionStatus"; @Column(name = "created_at", nullable = false) - private Instant createdAt = null; + private Instant createdAt; public static final String _createdAt = "createdAt"; @@ -76,7 +76,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { public static final String _isActive = "isActive"; public UUID getId() { - return id; + return this.id; } public void setId(UUID id) { @@ -84,7 +84,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { } public String getLabel() { - return label; + return this.label; } public void setLabel(String label) { @@ -92,7 +92,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { } public String getDefinition() { - return definition; + return this.definition; } public void setDefinition(String definition) { @@ -100,7 +100,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { } public PlanBlueprintStatus getStatus() { - return status; + return this.status; } public void setStatus(PlanBlueprintStatus status) { @@ -108,7 +108,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { } public UUID getGroupId() { - return groupId; + return this.groupId; } public void setGroupId(UUID groupId) { @@ -116,7 +116,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { } public Short getVersion() { - return version; + return this.version; } public void setVersion(Short version) { @@ -124,7 +124,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { } public PlanBlueprintVersionStatus getVersionStatus() { - return versionStatus; + return this.versionStatus; } public void setVersionStatus(PlanBlueprintVersionStatus versionStatus) { @@ -132,7 +132,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { } public Instant getCreatedAt() { - return createdAt; + return this.createdAt; } public void setCreatedAt(Instant createdAt) { @@ -140,7 +140,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { } public Instant getUpdatedAt() { - return updatedAt; + return this.updatedAt; } public void setUpdatedAt(Instant updatedAt) { @@ -148,7 +148,7 @@ public class PlanBlueprintEntity extends TenantScopedBaseEntity { } public IsActive getIsActive() { - return isActive; + return this.isActive; } public void setIsActive(IsActive isActive) { diff --git a/backend/core/src/main/java/org/opencdmp/data/PlanDescriptionTemplateEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanDescriptionTemplateEntity.java index b5186d56b..f82bfe672 100644 --- a/backend/core/src/main/java/org/opencdmp/data/PlanDescriptionTemplateEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanDescriptionTemplateEntity.java @@ -9,7 +9,7 @@ import java.time.Instant; import java.util.UUID; @Entity -@Table(name = "\"DmpDescriptionTemplate\"") +@Table(name = "\"PlanDescriptionTemplate\"") public class PlanDescriptionTemplateEntity extends TenantScopedBaseEntity { @Id @@ -18,7 +18,7 @@ public class PlanDescriptionTemplateEntity extends TenantScopedBaseEntity { public static final String _id = "id"; - @Column(name = "dmp", columnDefinition = "uuid", nullable = false) + @Column(name = "plan", columnDefinition = "uuid", nullable = false) private UUID planId; public static final String _planId = "planId"; diff --git a/backend/core/src/main/java/org/opencdmp/data/PlanEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanEntity.java index f976078a1..f3e6d072d 100644 --- a/backend/core/src/main/java/org/opencdmp/data/PlanEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanEntity.java @@ -1,21 +1,21 @@ package org.opencdmp.data; import jakarta.persistence.*; +import org.opencdmp.commons.enums.IsActive; import org.opencdmp.commons.enums.PlanAccessType; import org.opencdmp.commons.enums.PlanStatus; import org.opencdmp.commons.enums.PlanVersionStatus; -import org.opencdmp.commons.enums.IsActive; +import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.converters.enums.PlanAccessTypeNullableConverter; import org.opencdmp.data.converters.enums.PlanStatusConverter; import org.opencdmp.data.converters.enums.PlanVersionStatusConverter; -import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.tenant.TenantScopedBaseEntity; import java.time.Instant; import java.util.UUID; @Entity -@Table(name = "\"Dmp\"") +@Table(name = "\"Plan\"") public class PlanEntity extends TenantScopedBaseEntity { @Id diff --git a/backend/core/src/main/java/org/opencdmp/data/PlanReferenceEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanReferenceEntity.java index 39dc8f6d8..c80cb94f1 100644 --- a/backend/core/src/main/java/org/opencdmp/data/PlanReferenceEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanReferenceEntity.java @@ -1,15 +1,15 @@ package org.opencdmp.data; +import jakarta.persistence.*; import org.opencdmp.commons.enums.IsActive; import org.opencdmp.data.converters.enums.IsActiveConverter; import org.opencdmp.data.tenant.TenantScopedBaseEntity; -import jakarta.persistence.*; import java.time.Instant; import java.util.UUID; @Entity -@Table(name = "\"DmpReference\"") +@Table(name = "\"PlanReference\"") public class PlanReferenceEntity extends TenantScopedBaseEntity { @Id @@ -17,7 +17,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity { private UUID id; public static final String _id = "id"; - @Column(name = "dmp_id", columnDefinition = "uuid", nullable = false) + @Column(name = "plan_id", columnDefinition = "uuid", nullable = false) private UUID planId; public static final String _planId = "planId"; @@ -43,7 +43,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity { public static final String _isActive = "isActive"; public UUID getId() { - return id; + return this.id; } public void setId(UUID id) { @@ -51,7 +51,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity { } public UUID getPlanId() { - return planId; + return this.planId; } public void setPlanId(UUID planId) { @@ -59,7 +59,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity { } public UUID getReferenceId() { - return referenceId; + return this.referenceId; } public void setReferenceId(UUID referenceId) { @@ -67,7 +67,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity { } public String getData() { - return data; + return this.data; } public void setData(String data) { @@ -75,7 +75,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity { } public Instant getCreatedAt() { - return createdAt; + return this.createdAt; } public void setCreatedAt(Instant createdAt) { @@ -83,7 +83,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity { } public Instant getUpdatedAt() { - return updatedAt; + return this.updatedAt; } public void setUpdatedAt(Instant updatedAt) { @@ -91,7 +91,7 @@ public class PlanReferenceEntity extends TenantScopedBaseEntity { } public IsActive getIsActive() { - return isActive; + return this.isActive; } public void setIsActive(IsActive isActive) { diff --git a/backend/core/src/main/java/org/opencdmp/data/PlanUserEntity.java b/backend/core/src/main/java/org/opencdmp/data/PlanUserEntity.java index e00558a3d..689f2afda 100644 --- a/backend/core/src/main/java/org/opencdmp/data/PlanUserEntity.java +++ b/backend/core/src/main/java/org/opencdmp/data/PlanUserEntity.java @@ -1,17 +1,17 @@ package org.opencdmp.data; import jakarta.persistence.*; -import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.converters.enums.PlanUserRoleConverter; +import org.opencdmp.commons.enums.PlanUserRole; import org.opencdmp.data.converters.enums.IsActiveConverter; +import org.opencdmp.data.converters.enums.PlanUserRoleConverter; import org.opencdmp.data.tenant.TenantScopedBaseEntity; import java.time.Instant; import java.util.UUID; @Entity -@Table(name = "\"DmpUser\"") +@Table(name = "\"PlanUser\"") public class PlanUserEntity extends TenantScopedBaseEntity { @Id @@ -20,7 +20,7 @@ public class PlanUserEntity extends TenantScopedBaseEntity { public static final String _id = "id"; - @Column(name = "dmp", columnDefinition = "uuid", nullable = false) + @Column(name = "plan", columnDefinition = "uuid", nullable = false) private UUID planId; public static final String _planId = "planId"; diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxIntegrationEvent.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxIntegrationEvent.java index 0372a90e0..559b39919 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxIntegrationEvent.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxIntegrationEvent.java @@ -1,8 +1,8 @@ package org.opencdmp.integrationevent.outbox; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import org.opencdmp.integrationevent.TrackedEvent; import gr.cite.rabbitmq.IntegrationEvent; +import org.opencdmp.integrationevent.TrackedEvent; @JsonIgnoreProperties(ignoreUnknown = true) public class OutboxIntegrationEvent extends IntegrationEvent { @@ -25,10 +25,6 @@ public class OutboxIntegrationEvent extends IntegrationEvent { public static final String USER_REMOVE = "USER_REMOVE"; - public static final String PLAN_TOUCH = "PLAN_TOUCH"; - - public static final String DESCRIPTION_TOUCH = "DESCRIPTION_TOUCH"; - public static final String ANNOTATION_ENTITY_TOUCH = "ANNOTATION_ENTITY_TOUCH"; public static final String ANNOTATION_ENTITY_REMOVE = "ANNOTATION_ENTITY_REMOVE"; @@ -39,7 +35,7 @@ public class OutboxIntegrationEvent extends IntegrationEvent { private TrackedEvent event; public TrackedEvent getEvent() { - return event; + return this.event; } public void setEvent(TrackedEvent event) { diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxProperties.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxProperties.java index 225832f42..c09d7ab2a 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxProperties.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxProperties.java @@ -25,10 +25,6 @@ public class OutboxProperties { private final String userTouchTopic; - private final String planTouchTopic; - - private final String descriptionTouchTopic; - private final String annotationEntitiesTouchTopic; private final String annotationEntitiesRemovalTopic; @@ -49,8 +45,6 @@ public class OutboxProperties { String tenantUserInviteTopic, String userRemovalTopic, String userTouchTopic, - String planTouchTopic, - String descriptionTouchTopic, String annotationEntitiesTouchTopic, String annotationEntitiesRemovalTopic, String notifyTopic, @@ -71,8 +65,6 @@ public class OutboxProperties { this.tenantUserInviteTopic = tenantUserInviteTopic; this.userRemovalTopic = userRemovalTopic; this.userTouchTopic = userTouchTopic; - this.planTouchTopic = planTouchTopic; - this.descriptionTouchTopic = descriptionTouchTopic; this.annotationEntitiesTouchTopic = annotationEntitiesTouchTopic; this.annotationEntitiesRemovalTopic = annotationEntitiesRemovalTopic; this.notifyTopic = notifyTopic; @@ -133,14 +125,6 @@ public class OutboxProperties { return this.userTouchTopic; } - public String getPlanTouchTopic() { - return this.planTouchTopic; - } - - public String getDescriptionTouchTopic() { - return this.descriptionTouchTopic; - } - public String getAnnotationEntitiesTouchTopic() { return this.annotationEntitiesTouchTopic; } diff --git a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxRepositoryImpl.java b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxRepositoryImpl.java index 1766a7102..6c75a282e 100644 --- a/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxRepositoryImpl.java +++ b/backend/core/src/main/java/org/opencdmp/integrationevent/outbox/OutboxRepositoryImpl.java @@ -458,14 +458,6 @@ public class OutboxRepositoryImpl implements OutboxRepository { routingKey = this.outboxProperties.getUserTouchTopic(); break; } - case OutboxIntegrationEvent.PLAN_TOUCH: { - routingKey = this.outboxProperties.getPlanTouchTopic(); - break; - } - case OutboxIntegrationEvent.DESCRIPTION_TOUCH: { - routingKey = this.outboxProperties.getDescriptionTouchTopic(); - break; - } case OutboxIntegrationEvent.ANNOTATION_ENTITY_TOUCH: { routingKey = this.outboxProperties.getAnnotationEntitiesTouchTopic(); break; diff --git a/backend/core/src/main/java/org/opencdmp/model/deleter/UserDeleter.java b/backend/core/src/main/java/org/opencdmp/model/deleter/UserDeleter.java index f8c6d8ec2..ca251f397 100644 --- a/backend/core/src/main/java/org/opencdmp/model/deleter/UserDeleter.java +++ b/backend/core/src/main/java/org/opencdmp/model/deleter/UserDeleter.java @@ -1,13 +1,13 @@ package org.opencdmp.model.deleter; -import org.opencdmp.commons.enums.IsActive; -import org.opencdmp.data.*; -import org.opencdmp.query.*; import gr.cite.tools.data.deleter.Deleter; import gr.cite.tools.data.deleter.DeleterFactory; import gr.cite.tools.data.query.QueryFactory; import gr.cite.tools.logging.LoggerService; import gr.cite.tools.logging.MapLogEntry; +import org.opencdmp.commons.enums.IsActive; +import org.opencdmp.data.*; +import org.opencdmp.query.*; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.ConfigurableBeanFactory; @@ -22,7 +22,7 @@ import java.util.UUID; import java.util.stream.Collectors; @Component -@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class UserDeleter implements Deleter { private static final LoggerService logger = new LoggerService(LoggerFactory.getLogger(UserDeleter.class)); @@ -87,12 +87,6 @@ public class UserDeleter implements Deleter { TenantUserDeleter deleter = this.deleterFactory.deleter(TenantUserDeleter.class); deleter.delete(items); } -// { -// logger.debug("checking related - {}", DmpUserEntity.class.getSimpleName()); -// List items = this.queryFactory.query(DmpUserQuery.class).userIds(ids).collect(); -// DmpUserDeleter deleter = this.deleterFactory.deleter(DmpUserDeleter.class); -// deleter.delete(items); -// } Instant now = Instant.now(); for (UserEntity item : data) { diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java index 0df095587..82d941f9c 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/PlanPersist.java @@ -58,10 +58,6 @@ public class PlanPersist { private PlanAccessType accessType; public static final String _accessType = "accessType"; -// private List references; -// -// public static final String _references = "references"; - private List descriptionTemplates; public static final String _descriptionTemplates = "descriptionTemplates"; diff --git a/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanBlueprintValuePersist.java b/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanBlueprintValuePersist.java index 81e3bb73c..adc311f84 100644 --- a/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanBlueprintValuePersist.java +++ b/backend/core/src/main/java/org/opencdmp/model/persist/planproperties/PlanBlueprintValuePersist.java @@ -146,13 +146,11 @@ public class PlanBlueprintValuePersist { .iff(() -> this.fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && ((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required) .must(() -> !this.isListNullOrEmpty(item.getReferences())) // TODO: Cast Exception -// .failOn(DmpBlueprintValuePersist._references).failWith(messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(fieldEntity.getLabel()) ? fieldEntity.getLabel() : this.getReferenceTypeName(fieldEntity)}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintValuePersist._references).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : PlanBlueprintValuePersist._references}, LocaleContextHolder.getLocale())), this.spec() .iff(() -> this.fieldEntity.getCategory().equals(PlanBlueprintFieldCategory.ReferenceType) && this.isEmpty(item.getFieldValue()) && !((ReferenceTypeFieldEntity) this.fieldEntity).getMultipleSelect() && required) .must(() -> !this.isNull(item.getReference())) // TODO: Cast Exception -// .failOn(DmpBlueprintValuePersist._references).failWith(messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(fieldEntity.getLabel()) ? fieldEntity.getLabel() : this.getReferenceTypeName(fieldEntity)}, LocaleContextHolder.getLocale())), .failOn(PlanBlueprintValuePersist._reference).failWith(this.messageSource.getMessage("Validation_Required", new Object[]{!this.isEmpty(this.fieldEntity.getLabel()) ? this.fieldEntity.getLabel() : PlanBlueprintValuePersist._reference}, LocaleContextHolder.getLocale())), this.navSpec() .iff(() -> !this.isListNullOrEmpty(item.getReferences())) diff --git a/backend/web/src/main/resources/config/notification-devel.yml b/backend/web/src/main/resources/config/notification-devel.yml index 1a699b3f1..23677387b 100644 --- a/backend/web/src/main/resources/config/notification-devel.yml +++ b/backend/web/src/main/resources/config/notification-devel.yml @@ -16,4 +16,4 @@ notification: publicContactSupportType: B542B606-ACC6-4629-ADEF-4D8EE2F01222 tenantSpecificInvitationExternalUserType: 497dada5-eccc-4bc0-9e0b-63e22b4eb0be tenantSpecificInvitationExistingUserType: b3809c17-d1e4-420a-919c-828564114191 - contactSupportEmail: support@dmp.com \ No newline at end of file + contactSupportEmail: support@opencdmp.com \ No newline at end of file diff --git a/backend/web/src/main/resources/config/queue.yml b/backend/web/src/main/resources/config/queue.yml index 89061bb60..c8380e501 100644 --- a/backend/web/src/main/resources/config/queue.yml +++ b/backend/web/src/main/resources/config/queue.yml @@ -39,8 +39,6 @@ queue: tenant-user-invite-topic: tenant.invite user-touch-topic: user.touch user-removal-topic: user.remove - plan-touch-topic: plan.touch - description-touch-topic: description.touch annotation-entities-touch-topic: annotation.entities.touch annotation-entities-removal-topic: annotation.entities.remove what-you-know-about-me-completed-topic: whatyouknowaboutme.completed diff --git a/dmp-db-scema/updates/00.01.066_RenameDmpToPlan.sql b/dmp-db-scema/updates/00.01.066_RenameDmpToPlan.sql new file mode 100644 index 000000000..cb14e8d07 --- /dev/null +++ b/dmp-db-scema/updates/00.01.066_RenameDmpToPlan.sql @@ -0,0 +1,45 @@ +DO $$DECLARE + this_version CONSTANT varchar := '00.01.066'; +BEGIN + PERFORM * FROM "DBVersion" WHERE version = this_version; + IF FOUND THEN RETURN; END IF; + + ALTER TABLE IF EXISTS public."Description" RENAME dmp TO plan; + ALTER TABLE IF EXISTS public."Description" RENAME dmp_description_template TO plan_description_template; + ALTER TABLE IF EXISTS public."Description" RENAME CONSTRAINT "Description_dmp_description_template_fkey" TO "Description_plan_description_template_fkey"; + ALTER TABLE IF EXISTS public."Description" RENAME CONSTRAINT "Description_dmp_fkey" TO "Description_plan_fkey"; + + ALTER TABLE IF EXISTS public."DmpBlueprint" RENAME TO "PlanBlueprint"; + ALTER TABLE public."PlanBlueprint" RENAME CONSTRAINT "DMPPRofile_pkey" TO "PlanBlueprint_pkey"; + ALTER TABLE IF EXISTS public."PlanBlueprint" RENAME CONSTRAINT "DmpBlueprint_tenant_fkey" TO "PlanBlueprint_tenant_fkey"; + + ALTER TABLE IF EXISTS public."DmpDescriptionTemplate" RENAME TO "PlanDescriptionTemplate"; + ALTER TABLE IF EXISTS public."PlanDescriptionTemplate" RENAME dmp TO plan; + ALTER TABLE public."PlanDescriptionTemplate" RENAME CONSTRAINT "DmpDescriptionTemplate_pkey" TO "PlanDescriptionTemplate_pkey"; + ALTER TABLE IF EXISTS public."PlanDescriptionTemplate" RENAME CONSTRAINT "DmpDescriptionTemplate_dmp_fkey" TO "PlanDescriptionTemplate_plan_fkey"; + ALTER TABLE IF EXISTS public."PlanDescriptionTemplate" RENAME CONSTRAINT "DmpDescriptionTemplate_tenant_fkey" TO "PlanDescriptionTemplate_tenant_fkey"; + + + ALTER TABLE IF EXISTS public."Dmp" RENAME TO "Plan"; + ALTER TABLE public."Plan" RENAME CONSTRAINT "Dmp_pkey" TO "Plan_pkey"; + ALTER TABLE IF EXISTS public."Plan" RENAME CONSTRAINT "Dmp_blueprint_fkey" TO "Plan_blueprint_fkey"; + ALTER TABLE IF EXISTS public."Plan" RENAME CONSTRAINT "Dmp_creator_fkey" TO "Plan_creator_fkey"; + ALTER TABLE IF EXISTS public."Plan" RENAME CONSTRAINT "Dmp_tenant_fkey" TO "Plan_tenant_fkey"; + + ALTER TABLE IF EXISTS public."DmpReference" RENAME TO "PlanReference"; + ALTER TABLE IF EXISTS public."PlanReference" RENAME dmp_id TO plan_id; + ALTER TABLE public."PlanReference" RENAME CONSTRAINT "DmpReference_pkey" TO "PlanReference_pkey"; + ALTER TABLE IF EXISTS public."PlanReference" RENAME CONSTRAINT "DmpReference_dmp_id_fkey" TO "PlanReference_plan_id_fkey"; + ALTER TABLE IF EXISTS public."PlanReference" RENAME CONSTRAINT "DmpReference_reference_id_fkey" TO "PlanReference_reference_id_fkey"; + ALTER TABLE IF EXISTS public."PlanReference" RENAME CONSTRAINT "DmpReference_tenant_fkey" TO "PlanReference_tenant_fkey"; + + ALTER TABLE IF EXISTS public."DmpUser" RENAME TO "PlanUser"; + ALTER TABLE IF EXISTS public."PlanUser" RENAME dmp TO plan; + ALTER TABLE public."PlanUser" RENAME CONSTRAINT "DmpUser_pkey" TO "PlanUser_pkey"; + ALTER TABLE IF EXISTS public."PlanUser" RENAME CONSTRAINT "DmpUser_dmp_fkey" TO "PlanUser_plan_fkey"; + ALTER TABLE IF EXISTS public."PlanUser" RENAME CONSTRAINT "DmpUser_tenant_fkey" TO "PlanUser_tenant_fkey"; + ALTER TABLE IF EXISTS public."PlanUser" RENAME CONSTRAINT "DmpUser_user_fkey" TO "PlanUser_user_fkey"; + + INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.066', '2024-07-05 12:00:00.000000+02', now(), 'Rename dmp to plan.'); + +END$$; \ No newline at end of file