feat: community RPC 从内存存储迁移到 ent 数据库
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package migrate
|
||||
|
||||
import (
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
var (
|
||||
// CommentLikesColumns holds the columns for the "comment_likes" table.
|
||||
CommentLikesColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "comment_id", Type: field.TypeInt64},
|
||||
{Name: "user_id", Type: field.TypeInt64},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// CommentLikesTable holds the schema information for the "comment_likes" table.
|
||||
CommentLikesTable = &schema.Table{
|
||||
Name: "comment_likes",
|
||||
Columns: CommentLikesColumns,
|
||||
PrimaryKey: []*schema.Column{CommentLikesColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "commentlikes_comment_id_user_id",
|
||||
Unique: true,
|
||||
Columns: []*schema.Column{CommentLikesColumns[1], CommentLikesColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "commentlikes_user_id_comment_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{CommentLikesColumns[2], CommentLikesColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "commentlikes_user_id_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{CommentLikesColumns[2], CommentLikesColumns[3]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// CommentsColumns holds the columns for the "comments" table.
|
||||
CommentsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "post_id", Type: field.TypeInt64},
|
||||
{Name: "author_id", Type: field.TypeInt64},
|
||||
{Name: "content", Type: field.TypeString},
|
||||
{Name: "like_count", Type: field.TypeInt, Nullable: true, Default: 0},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "deleted_at", Type: field.TypeTime, Nullable: true},
|
||||
}
|
||||
// CommentsTable holds the schema information for the "comments" table.
|
||||
CommentsTable = &schema.Table{
|
||||
Name: "comments",
|
||||
Columns: CommentsColumns,
|
||||
PrimaryKey: []*schema.Column{CommentsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "comments_post_id_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{CommentsColumns[1], CommentsColumns[5]},
|
||||
},
|
||||
{
|
||||
Name: "comments_author_id_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{CommentsColumns[2], CommentsColumns[5]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// PostLikesColumns holds the columns for the "post_likes" table.
|
||||
PostLikesColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "post_id", Type: field.TypeInt64},
|
||||
{Name: "user_id", Type: field.TypeInt64},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
}
|
||||
// PostLikesTable holds the schema information for the "post_likes" table.
|
||||
PostLikesTable = &schema.Table{
|
||||
Name: "post_likes",
|
||||
Columns: PostLikesColumns,
|
||||
PrimaryKey: []*schema.Column{PostLikesColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "postlikes_post_id_user_id",
|
||||
Unique: true,
|
||||
Columns: []*schema.Column{PostLikesColumns[1], PostLikesColumns[2]},
|
||||
},
|
||||
{
|
||||
Name: "postlikes_user_id_post_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{PostLikesColumns[2], PostLikesColumns[1]},
|
||||
},
|
||||
{
|
||||
Name: "postlikes_user_id_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{PostLikesColumns[2], PostLikesColumns[3]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// PostsColumns holds the columns for the "posts" table.
|
||||
PostsColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeInt64, Increment: true},
|
||||
{Name: "author_id", Type: field.TypeInt64},
|
||||
{Name: "author_role", Type: field.TypeString, Size: 20, Default: "consumer"},
|
||||
{Name: "title", Type: field.TypeString, Size: 500},
|
||||
{Name: "content", Type: field.TypeString},
|
||||
{Name: "images", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
|
||||
{Name: "tags", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "text[]"}},
|
||||
{Name: "linked_order_id", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "quoted_post_id", Type: field.TypeInt64, Nullable: true},
|
||||
{Name: "like_count", Type: field.TypeInt, Nullable: true, Default: 0},
|
||||
{Name: "comment_count", Type: field.TypeInt, Nullable: true, Default: 0},
|
||||
{Name: "pinned", Type: field.TypeBool, Nullable: true, Default: false},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "deleted_at", Type: field.TypeTime, Nullable: true},
|
||||
}
|
||||
// PostsTable holds the schema information for the "posts" table.
|
||||
PostsTable = &schema.Table{
|
||||
Name: "posts",
|
||||
Columns: PostsColumns,
|
||||
PrimaryKey: []*schema.Column{PostsColumns[0]},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "posts_author_id_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{PostsColumns[1], PostsColumns[12]},
|
||||
},
|
||||
{
|
||||
Name: "posts_created_at",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{PostsColumns[12]},
|
||||
},
|
||||
{
|
||||
Name: "posts_linked_order_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{PostsColumns[7]},
|
||||
},
|
||||
{
|
||||
Name: "posts_quoted_post_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{PostsColumns[8]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// Tables holds all the tables in the schema.
|
||||
Tables = []*schema.Table{
|
||||
CommentLikesTable,
|
||||
CommentsTable,
|
||||
PostLikesTable,
|
||||
PostsTable,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
}
|
||||
Reference in New Issue
Block a user