From 4b4b9ae27771c3dae569c9590c5f069ed4bb9b4b Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Thu, 5 Jan 2023 21:16:52 +0100 Subject: [PATCH] add column for publisher --- .../java/com/covas/Entity/PublisherEntity.java | 16 +++++++++++++++- src/main/java/com/covas/Enum/Type.java | 6 ++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/covas/Enum/Type.java diff --git a/src/main/java/com/covas/Entity/PublisherEntity.java b/src/main/java/com/covas/Entity/PublisherEntity.java index a79c483..1a877a7 100644 --- a/src/main/java/com/covas/Entity/PublisherEntity.java +++ b/src/main/java/com/covas/Entity/PublisherEntity.java @@ -6,6 +6,8 @@ import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Table; @@ -13,8 +15,11 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.CascadeType; - +import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.GenericGenerator; + +import com.covas.Enum.Type; + import io.quarkus.hibernate.orm.panache.PanacheEntityBase; @@ -30,8 +35,17 @@ public class PublisherEntity extends PanacheEntityBase implements Serializable { @Column(columnDefinition="TEXT") public String description; + @Enumerated(EnumType.STRING) + public Type type; + + public String url; + + @Column(nullable = false) + public LocalDateTime created_at; @Column(nullable = false) public LocalDateTime updated_at; + @ColumnDefault("null") + public LocalDateTime deleted_at; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "users_id", referencedColumnName = "id") diff --git a/src/main/java/com/covas/Enum/Type.java b/src/main/java/com/covas/Enum/Type.java new file mode 100644 index 0000000..e9d6839 --- /dev/null +++ b/src/main/java/com/covas/Enum/Type.java @@ -0,0 +1,6 @@ +package com.covas.Enum; + +public enum Type { + VIDEO, PHOTO, TEXT, URL + +}