feat: add Index on comments.(type,status) and comments.parent_id (#686)

pull/688/head
wtune 2020-03-17 15:18:56 +08:00 committed by GitHub
parent 9ccd23d730
commit 03a43fb245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,10 @@ import javax.persistence.*;
*/
@Data
@Entity(name = "BaseComment")
@Table(name = "comments", indexes = {@Index(name = "comments_post_id", columnList = "post_id")})
@Table(name = "comments",
indexes = {@Index(name = "comments_post_id", columnList = "post_id"),
@Index(name = "comments_type_status", columnList = "type, status"),
@Index(name = "comments_parent_id", columnList = "parent_id")})
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.INTEGER, columnDefinition = "int default 0")
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)