Updating annotation entity, adding migration scripts (not all)
This commit is contained in:
parent
6e443c69fa
commit
20498001b3
|
@ -1,36 +0,0 @@
|
|||
package gr.cite.annotation.common.types.notification;
|
||||
|
||||
public class Attachment {
|
||||
|
||||
private String fileRef, fileName, mimeType;
|
||||
|
||||
public Attachment(String fileRef, String fileName, String mimeType) {
|
||||
this.fileRef = fileRef;
|
||||
this.fileName = fileName;
|
||||
this.mimeType = mimeType;
|
||||
}
|
||||
|
||||
public String getFileRef() {
|
||||
return fileRef;
|
||||
}
|
||||
|
||||
public void setFileRef(String fileRef) {
|
||||
this.fileRef = fileRef;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public String getMimeType() {
|
||||
return mimeType;
|
||||
}
|
||||
|
||||
public void setMimeType(String mimeType) {
|
||||
this.mimeType = mimeType;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package gr.cite.annotation.common.types.notification;
|
||||
|
||||
import gr.cite.annotation.common.enums.ContactInfoType;
|
||||
|
||||
public class ContactPair {
|
||||
private ContactInfoType type;
|
||||
private String contact;
|
||||
|
||||
public ContactPair(ContactInfoType type, String contact) {
|
||||
this.type = type;
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
public ContactPair() {
|
||||
}
|
||||
|
||||
public ContactInfoType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(ContactInfoType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public void setContact(String contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
}
|
|
@ -23,6 +23,16 @@ public class AnnotationEntity {
|
|||
|
||||
public static final String _entityId = "entityId";
|
||||
|
||||
@Column(name = "entity_type", nullable = false)
|
||||
private String entityType;
|
||||
|
||||
public static final String _entityType = "entityType";
|
||||
|
||||
@Column(name = "anchor")
|
||||
private String anchor;
|
||||
|
||||
public static final String _anchor = "anchor";
|
||||
|
||||
@Id
|
||||
@Column(name = "payload", nullable = false)
|
||||
private String payload;
|
||||
|
@ -61,6 +71,22 @@ public class AnnotationEntity {
|
|||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public String getEntityType() {
|
||||
return entityType;
|
||||
}
|
||||
|
||||
public void setEntityType(String entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public String getAnchor() {
|
||||
return anchor;
|
||||
}
|
||||
|
||||
public void setAnchor(String anchor) {
|
||||
this.anchor = anchor;
|
||||
}
|
||||
|
||||
public String getPayload() {
|
||||
return payload;
|
||||
}
|
||||
|
|
|
@ -2,15 +2,14 @@ package gr.cite.annotation.data;
|
|||
|
||||
import gr.cite.annotation.common.enums.IsActive;
|
||||
import gr.cite.annotation.data.conventers.IsActiveConverter;
|
||||
import gr.cite.annotation.data.tenant.TenantScopedBaseEntity;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"Language\"")
|
||||
public class LanguageEntity extends TenantScopedBaseEntity {
|
||||
@Table(name = "\"EntityUser\"")
|
||||
public class EntityUserEntity {
|
||||
|
||||
@Id
|
||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||
|
@ -18,15 +17,17 @@ public class LanguageEntity extends TenantScopedBaseEntity {
|
|||
|
||||
public static final String _id = "id";
|
||||
|
||||
@Column(name = "code", length = 20, nullable = false)
|
||||
private String code;
|
||||
@Id
|
||||
@Column(name = "id", columnDefinition = "uuid", nullable = false)
|
||||
private UUID entityId;
|
||||
|
||||
public static final String _code = "code";
|
||||
public static final String _entityId = "entityId";
|
||||
|
||||
@Column(name = "ordinal")
|
||||
private Integer ordinal;
|
||||
@Id
|
||||
@Column(name = "id", columnDefinition = "uuid", nullable = false)
|
||||
private UUID userId;
|
||||
|
||||
public static final String _ordinal = "ordinal";
|
||||
public static final String _userId = "userId";
|
||||
|
||||
@Column(name = "\"created_at\"", nullable = false)
|
||||
private Instant createdAt;
|
||||
|
@ -52,20 +53,20 @@ public class LanguageEntity extends TenantScopedBaseEntity {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
public UUID getEntityId() {
|
||||
return entityId;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
public void setEntityId(UUID entityId) {
|
||||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public Integer getOrdinal() {
|
||||
return ordinal;
|
||||
public UUID getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setOrdinal(Integer ordinal) {
|
||||
this.ordinal = ordinal;
|
||||
public void setUserId(UUID userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Instant getCreatedAt() {
|
|
@ -1,97 +0,0 @@
|
|||
package gr.cite.annotation.data;
|
||||
|
||||
import gr.cite.annotation.common.enums.IsActive;
|
||||
import gr.cite.annotation.data.conventers.IsActiveConverter;
|
||||
import gr.cite.annotation.data.tenant.TenantScopedBaseEntity;
|
||||
import jakarta.persistence.*;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "\"UserRole\"")
|
||||
public class UserRoleEntity extends TenantScopedBaseEntity {
|
||||
|
||||
@Id
|
||||
@Column(name = "id", columnDefinition = "uuid", updatable = false, nullable = false)
|
||||
private UUID id;
|
||||
|
||||
public static final String _id = "id";
|
||||
|
||||
@Column(name = "role", length = UserRoleEntity._roleLength, nullable = false)
|
||||
private String role;
|
||||
|
||||
public static final String _role = "role";
|
||||
|
||||
public static final int _roleLength = 512;
|
||||
|
||||
@Column(name = "\"user\"", nullable = false)
|
||||
private UUID userId;
|
||||
|
||||
public static final String _userId = "userId";
|
||||
|
||||
@Column(name = "created_at", nullable = false)
|
||||
private Instant createdAt;
|
||||
|
||||
public static final String _createdAt = "createdAt";
|
||||
|
||||
@Column(name = "updated_at", nullable = false)
|
||||
private Instant updatedAt;
|
||||
|
||||
public static final String _updatedAt = "updatedAt";
|
||||
|
||||
@Column(name = "\"is_active\"", nullable = false)
|
||||
@Convert(converter = IsActiveConverter.class)
|
||||
private IsActive isActive;
|
||||
|
||||
public static final String _isActive = "isActive";
|
||||
|
||||
public UUID getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public UUID getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(UUID userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Instant getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(Instant createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public Instant getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(Instant updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public IsActive getIsActive() {
|
||||
return isActive;
|
||||
}
|
||||
|
||||
public void setIsActive(IsActive isActive) {
|
||||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
}
|
|
@ -15,6 +15,14 @@ public class Annotation {
|
|||
|
||||
public static final String _entityId = "entityId";
|
||||
|
||||
private String entityType;
|
||||
|
||||
public static final String _entityType = "entityType";
|
||||
|
||||
private String anchor;
|
||||
|
||||
public static final String _anchor = "anchor";
|
||||
|
||||
private String payload;
|
||||
|
||||
public static final String _payload = "payload";
|
||||
|
@ -47,6 +55,22 @@ public class Annotation {
|
|||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public String getEntityType() {
|
||||
return entityType;
|
||||
}
|
||||
|
||||
public void setEntityType(String entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public String getAnchor() {
|
||||
return anchor;
|
||||
}
|
||||
|
||||
public void setAnchor(String anchor) {
|
||||
this.anchor = anchor;
|
||||
}
|
||||
|
||||
public String getPayload() {
|
||||
return payload;
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@ package gr.cite.annotation.model.builder;
|
|||
import gr.cite.annotation.authorization.AuthorizationFlags;
|
||||
import gr.cite.annotation.convention.ConventionService;
|
||||
import gr.cite.annotation.data.AnnotationEntity;
|
||||
import gr.cite.annotation.data.UserEntity;
|
||||
import gr.cite.annotation.model.Annotation;
|
||||
import gr.cite.annotation.model.User;
|
||||
import gr.cite.tools.exception.MyApplicationException;
|
||||
import gr.cite.tools.fieldset.FieldSet;
|
||||
import gr.cite.tools.logging.DataLogEntry;
|
||||
|
@ -36,7 +34,8 @@ public class AnnotationBuilder extends BaseBuilder<Annotation, AnnotationEntity>
|
|||
public List<Annotation> build(FieldSet fields, List<AnnotationEntity> data) throws MyApplicationException {
|
||||
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
|
||||
this.logger.trace(new DataLogEntry("requested fields", fields));
|
||||
if (fields == null || fields.isEmpty()) return new ArrayList<>();
|
||||
if (fields == null || fields.isEmpty())
|
||||
return new ArrayList<>();
|
||||
|
||||
List<Annotation> models = new ArrayList<>();
|
||||
|
||||
|
@ -44,12 +43,22 @@ public class AnnotationBuilder extends BaseBuilder<Annotation, AnnotationEntity>
|
|||
return models;
|
||||
for (AnnotationEntity d : data) {
|
||||
Annotation m = new Annotation();
|
||||
if (fields.hasField(this.asIndexer(Annotation._id))) m.setId(d.getId());
|
||||
if (fields.hasField(this.asIndexer(Annotation._entityId))) m.setEntityId(d.getEntityId());
|
||||
if (fields.hasField(this.asIndexer(Annotation._payload))) m.setPayload(d.getPayload());
|
||||
if (fields.hasField(this.asIndexer(Annotation._createdAt))) m.setCreatedAt(d.getCreatedAt());
|
||||
if (fields.hasField(this.asIndexer(Annotation._updatedAt))) m.setUpdatedAt(d.getUpdatedAt());
|
||||
if (fields.hasField(this.asIndexer(Annotation._isActive))) m.setIsActive(d.getIsActive());
|
||||
if (fields.hasField(this.asIndexer(Annotation._id)))
|
||||
m.setId(d.getId());
|
||||
if (fields.hasField(this.asIndexer(Annotation._entityId)))
|
||||
m.setEntityId(d.getEntityId());
|
||||
if (fields.hasField(this.asIndexer(Annotation._entityType)))
|
||||
m.setEntityType(d.getEntityType());
|
||||
if (fields.hasField(this.asIndexer(Annotation._anchor)))
|
||||
m.setAnchor(d.getAnchor());
|
||||
if (fields.hasField(this.asIndexer(Annotation._payload)))
|
||||
m.setPayload(d.getPayload());
|
||||
if (fields.hasField(this.asIndexer(Annotation._createdAt)))
|
||||
m.setCreatedAt(d.getCreatedAt());
|
||||
if (fields.hasField(this.asIndexer(Annotation._updatedAt)))
|
||||
m.setUpdatedAt(d.getUpdatedAt());
|
||||
if (fields.hasField(this.asIndexer(Annotation._isActive)))
|
||||
m.setIsActive(d.getIsActive());
|
||||
models.add(m);
|
||||
}
|
||||
this.logger.debug("build {} items", Optional.of(models).map(List::size).orElse(0));
|
||||
|
|
|
@ -24,6 +24,14 @@ public class AnnotationPersist {
|
|||
|
||||
public static final String _entityId = "entityId";
|
||||
|
||||
private String entityType;
|
||||
|
||||
public static final String _entityType = "entityType";
|
||||
|
||||
private String anchor;
|
||||
|
||||
public static final String _anchor = "anchor";
|
||||
|
||||
private String payload;
|
||||
|
||||
public static final String _payload = "payload";
|
||||
|
@ -44,6 +52,22 @@ public class AnnotationPersist {
|
|||
this.entityId = entityId;
|
||||
}
|
||||
|
||||
public String getEntityType() {
|
||||
return entityType;
|
||||
}
|
||||
|
||||
public void setEntityType(String entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public String getAnchor() {
|
||||
return anchor;
|
||||
}
|
||||
|
||||
public void setAnchor(String anchor) {
|
||||
this.anchor = anchor;
|
||||
}
|
||||
|
||||
public String getPayload() {
|
||||
return payload;
|
||||
}
|
||||
|
@ -82,7 +106,10 @@ public class AnnotationPersist {
|
|||
.must(() -> this.isValidGuid(item.getEntityId()))
|
||||
.failOn(AnnotationPersist._entityId).failWith(messageSource.getMessage("Validation_Required", new Object[]{AnnotationPersist._entityId}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.must(() -> this.isEmpty(item.getPayload()))
|
||||
.must(() -> !this.isEmpty(item.getEntityType()))
|
||||
.failOn(AnnotationPersist._entityType).failWith(messageSource.getMessage("Validation_Required", new Object[]{AnnotationPersist._entityType}, LocaleContextHolder.getLocale())),
|
||||
this.spec()
|
||||
.must(() -> !this.isEmpty(item.getPayload()))
|
||||
.failOn(AnnotationPersist._payload).failWith(messageSource.getMessage("Validation_Required", new Object[]{AnnotationPersist._payload}, LocaleContextHolder.getLocale()))
|
||||
);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ public class AnnotationQuery extends QueryBase<AnnotationEntity> {
|
|||
|
||||
private Collection<UUID> entityIds;
|
||||
|
||||
private Collection<String> entityTypes;
|
||||
|
||||
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
|
||||
|
||||
private final UserScope userScope;
|
||||
|
@ -109,6 +111,21 @@ public class AnnotationQuery extends QueryBase<AnnotationEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public AnnotationQuery entityTypes(String value) {
|
||||
this.entityTypes = List.of(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public AnnotationQuery entityTypes(String... value) {
|
||||
this.entityTypes = Arrays.asList(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public AnnotationQuery entityTypes(Collection<String> values) {
|
||||
this.entityTypes = values;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isFalseQuery() {
|
||||
return this.isEmpty(this.ids) || this.isEmpty(this.excludedIds) || this.isEmpty(this.isActives) || this.isEmpty(this.entityIds);
|
||||
|
@ -153,6 +170,12 @@ public class AnnotationQuery extends QueryBase<AnnotationEntity> {
|
|||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
if (this.entityTypes != null) {
|
||||
CriteriaBuilder.In<String> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(AnnotationEntity._entityType));
|
||||
for (String item : this.entityTypes)
|
||||
inClause.value(item);
|
||||
predicates.add(inClause);
|
||||
}
|
||||
|
||||
if (!predicates.isEmpty()) {
|
||||
Predicate[] predicatesArray = predicates.toArray(new Predicate[0]);
|
||||
|
@ -168,6 +191,10 @@ public class AnnotationQuery extends QueryBase<AnnotationEntity> {
|
|||
return AnnotationEntity._id;
|
||||
else if (item.match(Annotation._entityId))
|
||||
return AnnotationEntity._entityId;
|
||||
else if (item.match(Annotation._entityType))
|
||||
return AnnotationEntity._entityType;
|
||||
else if (item.match(Annotation._anchor))
|
||||
return AnnotationEntity._anchor;
|
||||
else if (item.match(Annotation._payload))
|
||||
return AnnotationEntity._payload;
|
||||
else if (item.match(Annotation._createdAt))
|
||||
|
@ -186,6 +213,8 @@ public class AnnotationQuery extends QueryBase<AnnotationEntity> {
|
|||
AnnotationEntity item = new AnnotationEntity();
|
||||
item.setId(QueryBase.convertSafe(tuple, columns, AnnotationEntity._id, UUID.class));
|
||||
item.setEntityId(QueryBase.convertSafe(tuple, columns, AnnotationEntity._entityId, UUID.class));
|
||||
item.setEntityType(QueryBase.convertSafe(tuple, columns, AnnotationEntity._entityType, String.class));
|
||||
item.setAnchor(QueryBase.convertSafe(tuple, columns, AnnotationEntity._anchor, String.class));
|
||||
item.setPayload(QueryBase.convertSafe(tuple, columns, AnnotationEntity._payload, String.class));
|
||||
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, AnnotationEntity._createdAt, Instant.class));
|
||||
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, AnnotationEntity._updatedAt, Instant.class));
|
||||
|
|
|
@ -20,6 +20,8 @@ public class AnnotationLookup extends Lookup {
|
|||
|
||||
private List<UUID> entityIds;
|
||||
|
||||
private List<String> entityTypes;
|
||||
|
||||
public String getLike() {
|
||||
return like;
|
||||
}
|
||||
|
@ -52,6 +54,22 @@ public class AnnotationLookup extends Lookup {
|
|||
this.isActive = isActive;
|
||||
}
|
||||
|
||||
public List<UUID> getEntityIds() {
|
||||
return entityIds;
|
||||
}
|
||||
|
||||
public void setEntityIds(List<UUID> entityIds) {
|
||||
this.entityIds = entityIds;
|
||||
}
|
||||
|
||||
public List<String> getEntityTypes() {
|
||||
return entityTypes;
|
||||
}
|
||||
|
||||
public void setEntityTypes(List<String> entityTypes) {
|
||||
this.entityTypes = entityTypes;
|
||||
}
|
||||
|
||||
public AnnotationQuery enrich(QueryFactory queryFactory) {
|
||||
AnnotationQuery query = queryFactory.query(AnnotationQuery.class);
|
||||
if (this.like != null)
|
||||
|
@ -64,6 +82,8 @@ public class AnnotationLookup extends Lookup {
|
|||
query.isActive(this.isActive);
|
||||
if (this.entityIds != null)
|
||||
query.entityIds(this.entityIds);
|
||||
if (this.entityTypes != null)
|
||||
query.entityTypes(this.entityTypes);
|
||||
|
||||
this.enrichCommon(query);
|
||||
|
||||
|
|
|
@ -64,6 +64,8 @@ public class AnnotationServiceImpl implements AnnotationService {
|
|||
AnnotationEntity data = new AnnotationEntity();
|
||||
data.setId(UUID.randomUUID());
|
||||
data.setEntityId(model.getEntityId());
|
||||
data.setEntityType(model.getEntityType());
|
||||
data.setAnchor(model.getAnchor());
|
||||
data.setPayload(model.getPayload());
|
||||
data.setCreatedAt(Instant.now());
|
||||
data.setUpdatedAt(Instant.now());
|
||||
|
|
|
@ -4,6 +4,16 @@ BEGIN
|
|||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
||||
CREATE TABLE public."ntf_Tenant"
|
||||
(
|
||||
id uuid NOT NULL,
|
||||
code character varying(200) COLLATE pg_catalog."default" NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL DEFAULT now(),
|
||||
updated_at timestamp without time zone NOT NULL DEFAULT now(),
|
||||
is_active smallint NOT NULL DEFAULT 1,
|
||||
CONSTRAINT "ntf_Tenant_pkey" PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE public."ntf_TenantConfiguration"
|
||||
(
|
||||
id uuid NOT NULL,
|
||||
|
@ -15,11 +25,11 @@ BEGIN
|
|||
updated_at timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "ntf_TenantConfguration_pkey" PRIMARY KEY (id),
|
||||
CONSTRAINT "ntf_TenantConfiguration_tenant_fkey" FOREIGN KEY (tenant)
|
||||
REFERENCES public."Tenant" (id) MATCH SIMPLE
|
||||
REFERENCES public."ntf_Tenant" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.035', '2023-12-05 12:00:00.000000+02', now(), 'Add table ntf_TenantConfiguration.');
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.035', '2023-12-05 12:00:00.000000+02', now(), 'Add tables ntf_Tenant and ntf_TenantConfiguration.');
|
||||
|
||||
END$$;
|
|
@ -0,0 +1,32 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.048';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
||||
CREATE TABLE public."ant_QueueInbox"
|
||||
(
|
||||
id uuid NOT NULL,
|
||||
queue character varying(50) COLLATE pg_catalog."default" NOT NULL,
|
||||
exchange character varying(50) COLLATE pg_catalog."default" NOT NULL,
|
||||
route character varying(50) COLLATE pg_catalog."default" NOT NULL,
|
||||
application_id character varying(100) COLLATE pg_catalog."default" NOT NULL,
|
||||
message_id uuid NOT NULL,
|
||||
message json NOT NULL,
|
||||
retry_count integer,
|
||||
status character varying(50) COLLATE pg_catalog."default" NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
tenant uuid,
|
||||
is_active smallint NOT NULL,
|
||||
CONSTRAINT "ant_QueryInbox_pkey" PRIMARY KEY (id),
|
||||
CONSTRAINT "ant_QueryInbox_tenant_fkey" FOREIGN KEY (tenant)
|
||||
REFERENCES public."Tenant" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
NOT VALID
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.048', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_QueueInbox.');
|
||||
|
||||
END$$;
|
|
@ -0,0 +1,31 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.049';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
||||
CREATE TABLE public."ant_QueueOutbox"
|
||||
(
|
||||
id uuid NOT NULL,
|
||||
exchange character varying(200) COLLATE pg_catalog."default" NOT NULL,
|
||||
route character varying(200) COLLATE pg_catalog."default" NOT NULL,
|
||||
message_id uuid NOT NULL,
|
||||
notify_status character varying(100) COLLATE pg_catalog."default" NOT NULL,
|
||||
retry_count integer NOT NULL,
|
||||
published_at timestamp without time zone,
|
||||
confirmed_at timestamp without time zone,
|
||||
tenant uuid,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
message text COLLATE pg_catalog."default" NOT NULL,
|
||||
is_active smallint NOT NULL,
|
||||
CONSTRAINT "ant_QueueOutbox_pkey" PRIMARY KEY (id),
|
||||
CONSTRAINT "ant_QueueOutbox_tenant_fkey" FOREIGN KEY (tenant)
|
||||
REFERENCES public."Tenant" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.049', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_QueueOutbox.');
|
||||
|
||||
END$$;
|
|
@ -0,0 +1,35 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.050';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
||||
CREATE TABLE public."ant_Tenant"
|
||||
(
|
||||
id uuid NOT NULL,
|
||||
code character varying(200) COLLATE pg_catalog."default" NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL DEFAULT now(),
|
||||
updated_at timestamp without time zone NOT NULL DEFAULT now(),
|
||||
is_active smallint NOT NULL DEFAULT 1,
|
||||
CONSTRAINT "ant_Tenant_pkey" PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE public."ant_TenantConfiguration"
|
||||
(
|
||||
id uuid NOT NULL,
|
||||
tenant uuid NOT NULL,
|
||||
type smallint NOT NULL,
|
||||
value character varying COLLATE pg_catalog."default" NOT NULL,
|
||||
is_active smallint NOT NULL,
|
||||
created_at timestamp without time zone NOT NULL,
|
||||
updated_at timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "ant_TenantConfguration_pkey" PRIMARY KEY (id),
|
||||
CONSTRAINT "ant_TenantConfiguration_tenant_fkey" FOREIGN KEY (tenant)
|
||||
REFERENCES public."ant_Tenant" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
);
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.050', '2024-02-13 12:00:00.000000+02', now(), 'Add tables ant_Tenant and ant_TenantConfiguration.');
|
||||
|
||||
END$$;
|
|
@ -0,0 +1,20 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.051';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public."ant_User"
|
||||
(
|
||||
"id" uuid NOT NULL,
|
||||
"name" character varying(250) COLLATE pg_catalog."default",
|
||||
"additional_info" character varying COLLATE pg_catalog."default",
|
||||
"created_at" timestamp without time zone NOT NULL DEFAULT now(),
|
||||
"updated_at" timestamp without time zone NOT NULL DEFAULT now(),
|
||||
"is_active" smallint NOT NULL DEFAULT 1,
|
||||
CONSTRAINT "ant_User_pkey" PRIMARY KEY (id)
|
||||
)
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.051', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_User.');
|
||||
|
||||
END$$;
|
|
@ -0,0 +1,31 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.052';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public."ant_UserCredential"
|
||||
(
|
||||
"id" uuid NOT NULL,
|
||||
"user" uuid NOT NULL,
|
||||
"external_id" character varying(512) COLLATE pg_catalog."default" NOT NULL,
|
||||
"created_at" timestamp without time zone NOT NULL,
|
||||
"updated_at" timestamp without time zone NOT NULL,
|
||||
"is_active" smallint NOT NULL DEFAULT 1,
|
||||
"tenant" uuid,
|
||||
"data" character varying COLLATE pg_catalog."default",
|
||||
CONSTRAINT "ant_UserCredential_pkey" PRIMARY KEY (id),
|
||||
CONSTRAINT "ant_UserCredential_tenant_fkey" FOREIGN KEY ("tenant")
|
||||
REFERENCES public."ant_Tenant" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
NOT VALID,
|
||||
CONSTRAINT "ant_UserCredential_user_fkey" FOREIGN KEY ("user")
|
||||
REFERENCES public."ant_User" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
)
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.052', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_UserCredential.');
|
||||
|
||||
END$$;
|
|
@ -0,0 +1,28 @@
|
|||
DO $$DECLARE
|
||||
this_version CONSTANT varchar := '00.01.053';
|
||||
BEGIN
|
||||
PERFORM * FROM "DBVersion" WHERE version = this_version;
|
||||
IF FOUND THEN RETURN; END IF;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public."ant_TenantUser"
|
||||
(
|
||||
"id" uuid NOT NULL,
|
||||
"user" uuid NOT NULL,
|
||||
"tenant" uuid NOT NULL,
|
||||
"is_active" smallint NOT NULL,
|
||||
"created_at" timestamp without time zone NOT NULL,
|
||||
"updated_at" timestamp without time zone NOT NULL,
|
||||
CONSTRAINT "ant_TenantUser_pkey" PRIMARY KEY (id),
|
||||
CONSTRAINT "ant_TenantUser_tenant_fkey" FOREIGN KEY ("tenant")
|
||||
REFERENCES public."ant_Tenant" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION,
|
||||
CONSTRAINT "ant_TenantUser_user_fkey" FOREIGN KEY ("user")
|
||||
REFERENCES public."ant_User" (id) MATCH SIMPLE
|
||||
ON UPDATE NO ACTION
|
||||
ON DELETE NO ACTION
|
||||
)
|
||||
|
||||
INSERT INTO public."DBVersion" VALUES ('DMPDB', '00.01.053', '2024-02-13 12:00:00.000000+02', now(), 'Add table ant_TenantUser.');
|
||||
|
||||
END$$;
|
Loading…
Reference in New Issue