Browse Source

[FIX-7732][fix] fix column 'is_directory' of table `t_ds_resources` type error in PG database (#7898)

Fix column 'is_directory' of table t_ds_resources type error in PG database
This closes #7732
3.0.0/version-upgrade
天仇 3 years ago committed by GitHub
parent
commit
361d68db26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 455
      dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Resource.java
  2. 2
      dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql

455
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Resource.java

@ -28,219 +28,208 @@ import com.fasterxml.jackson.annotation.JsonFormat;
@TableName("t_ds_resources") @TableName("t_ds_resources")
public class Resource { public class Resource {
/** /**
* id * id
*/ */
@TableId(value="id", type=IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private int id; private int id;
/** /**
* parent id * parent id
*/ */
private int pid; private int pid;
/** /**
* resource alias * resource alias
*/ */
private String alias; private String alias;
/** /**
* full name * full name
*/ */
private String fullName; private String fullName;
/** /**
* is directory * is directory
*/ */
private boolean isDirectory=false; private boolean isDirectory = false;
/** /**
* description * description
*/ */
private String description; private String description;
/** /**
* file alias * file alias
*/ */
private String fileName; private String fileName;
/** /**
* user id * user id
*/ */
private int userId; private int userId;
/** /**
* resource type * resource type
*/ */
private ResourceType type; private ResourceType type;
/** /**
* resource size * resource size
*/ */
private long size; private long size;
/** /**
* create time * create time
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; private Date createTime;
/** /**
* update time * update time
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime; private Date updateTime;
public Resource() { public Resource() {
} }
public Resource(int id, String alias, String fileName, String description, int userId, public Resource(int id, String alias, String fileName, String description, int userId,
ResourceType type, long size, ResourceType type, long size,
Date createTime, Date updateTime) { Date createTime, Date updateTime) {
this.id = id; this.id = id;
this.alias = alias; this.alias = alias;
this.fileName = fileName; this.fileName = fileName;
this.description = description; this.description = description;
this.userId = userId; this.userId = userId;
this.type = type; this.type = type;
this.size = size; this.size = size;
this.createTime = createTime; this.createTime = createTime;
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public Resource(int id, int pid, String alias, String fullName, boolean isDirectory) { public Resource(int id, int pid, String alias, String fullName, boolean isDirectory) {
this.id = id; this.id = id;
this.pid = pid; this.pid = pid;
this.alias = alias; this.alias = alias;
this.fullName = fullName; this.fullName = fullName;
this.isDirectory = isDirectory; this.isDirectory = isDirectory;
} }
/*public Resource(String alias, String fileName, String description, int userId, ResourceType type, long size, Date createTime, Date updateTime) { public Resource(int pid, String alias, String fullName, boolean isDirectory, String description, String fileName, int userId, ResourceType type, long size, Date createTime, Date updateTime) {
this.alias = alias; this.pid = pid;
this.fileName = fileName; this.alias = alias;
this.description = description; this.fullName = fullName;
this.userId = userId; this.isDirectory = isDirectory;
this.type = type; this.description = description;
this.size = size; this.fileName = fileName;
this.createTime = createTime; this.userId = userId;
this.updateTime = updateTime; this.type = type;
}*/ this.size = size;
this.createTime = createTime;
public Resource(int pid, String alias, String fullName, boolean isDirectory, String description, String fileName, int userId, ResourceType type, long size, Date createTime, Date updateTime) { this.updateTime = updateTime;
this.pid = pid; }
this.alias = alias;
this.fullName = fullName; public int getId() {
this.isDirectory = isDirectory; return id;
this.description = description; }
this.fileName = fileName;
this.userId = userId; public void setId(int id) {
this.type = type; this.id = id;
this.size = size; }
this.createTime = createTime;
this.updateTime = updateTime; public String getAlias() {
} return alias;
}
public int getId() {
return id; public void setAlias(String alias) {
} this.alias = alias;
}
public void setId(int id) {
this.id = id; public int getPid() {
} return pid;
}
public String getAlias() {
return alias; public void setPid(int pid) {
} this.pid = pid;
}
public void setAlias(String alias) {
this.alias = alias; public String getFullName() {
} return fullName;
}
public int getPid() {
return pid; public void setFullName(String fullName) {
} this.fullName = fullName;
}
public void setPid(int pid) {
this.pid = pid; public boolean isDirectory() {
} return isDirectory;
}
public String getFullName() {
return fullName; public void setDirectory(boolean directory) {
} isDirectory = directory;
}
public void setFullName(String fullName) {
this.fullName = fullName; public String getFileName() {
} return fileName;
}
public boolean isDirectory() {
return isDirectory; public void setFileName(String fileName) {
} this.fileName = fileName;
}
public void setDirectory(boolean directory) {
isDirectory = directory;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public ResourceType getType() {
return type;
}
public void setType(ResourceType type) {
this.type = type;
}
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override public String getDescription() {
public String toString() { return description;
return "Resource{" + }
public void setDescription(String description) {
this.description = description;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public ResourceType getType() {
return type;
}
public void setType(ResourceType type) {
this.type = type;
}
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "Resource{" +
"id=" + id + "id=" + id +
", pid=" + pid + ", pid=" + pid +
", alias='" + alias + '\'' + ", alias='" + alias + '\'' +
@ -254,30 +243,30 @@ public class Resource {
", createTime=" + createTime + ", createTime=" + createTime +
", updateTime=" + updateTime + ", updateTime=" + updateTime +
'}'; '}';
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
} }
Resource resource = (Resource) o; @Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (id != resource.id) { Resource resource = (Resource) o;
return false;
}
return alias.equals(resource.alias);
} if (id != resource.id) {
return false;
}
return alias.equals(resource.alias);
@Override }
public int hashCode() {
int result = id; @Override
result = 31 * result + alias.hashCode(); public int hashCode() {
return result; int result = id;
} result = 31 * result + alias.hashCode();
return result;
}
} }

2
dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql

@ -664,7 +664,7 @@ CREATE TABLE t_ds_resources (
update_time timestamp DEFAULT NULL , update_time timestamp DEFAULT NULL ,
pid int, pid int,
full_name varchar(64), full_name varchar(64),
is_directory int, is_directory boolean DEFAULT FALSE,
PRIMARY KEY (id), PRIMARY KEY (id),
CONSTRAINT t_ds_resources_un UNIQUE (full_name, type) CONSTRAINT t_ds_resources_un UNIQUE (full_name, type)
) ; ) ;

Loading…
Cancel
Save