mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-25 15:55:18 +08:00
禁用创建外键sql
This commit is contained in:
@@ -12,4 +12,15 @@ public class MyPostgreSQLDialect extends PostgreSQLDialect {
|
|||||||
}
|
}
|
||||||
return super.columnType(sqlTypeCode);
|
return super.columnType(sqlTypeCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAddForeignKeyConstraintString(String constraintName, String[] foreignKey, String referencedTable, String[] primaryKey, boolean referencesPrimaryKey) {
|
||||||
|
return " DROP CONSTRAINT IF EXISTS notexist ";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAddForeignKeyConstraintString(String constraintName, String foreignKeyDefinition) {
|
||||||
|
return " DROP CONSTRAINT IF EXISTS notexist ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package cn.lihongjie.coal.entity;
|
package cn.lihongjie.coal.entity;
|
||||||
|
|
||||||
import cn.lihongjie.coal.entity.base.CommonEntity;
|
import cn.lihongjie.coal.entity.base.CommonEntity;
|
||||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.JoinTable;
|
||||||
import jakarta.persistence.ManyToMany;
|
import jakarta.persistence.ManyToMany;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.hibernate.annotations.Comment;
|
import org.hibernate.annotations.Comment;
|
||||||
@@ -15,7 +15,9 @@ import java.util.List;
|
|||||||
public class PermissionEntity extends CommonEntity {
|
public class PermissionEntity extends CommonEntity {
|
||||||
|
|
||||||
|
|
||||||
@ManyToMany(mappedBy = "permissions")
|
@ManyToMany()
|
||||||
|
@JoinTable(foreignKey = @jakarta.persistence.ForeignKey(name = "none" , value = jakarta.persistence.ConstraintMode.NO_CONSTRAINT),
|
||||||
|
inverseForeignKey = @jakarta.persistence.ForeignKey(name = "none" , value = jakarta.persistence.ConstraintMode.NO_CONSTRAINT))
|
||||||
private List<ResourceEntity> resources;
|
private List<ResourceEntity> resources;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class ResourceEntity extends CommonEntity {
|
public class ResourceEntity extends CommonEntity {
|
||||||
|
|
||||||
@ManyToMany
|
@ManyToMany(mappedBy = "resources")
|
||||||
private List<PermissionEntity> permissions;
|
private List<PermissionEntity> permissions;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user