mirror of
https://github.com/astaxie/beego.git
synced 2025-07-03 16:40:18 +00:00
fix #302
This commit is contained in:
@ -122,7 +122,7 @@ type Post struct {
|
||||
Content string `orm:"type(text)"`
|
||||
Created time.Time `orm:"auto_now_add"`
|
||||
Updated time.Time `orm:"auto_now"`
|
||||
Tags []*Tag `orm:"rel(m2m)"`
|
||||
Tags []*Tag `orm:"rel(m2m);rel_through(github.com/astaxie/beego/orm.PostTags)"`
|
||||
}
|
||||
|
||||
func (u *Post) TableIndex() [][]string {
|
||||
@ -148,6 +148,16 @@ func NewTag() *Tag {
|
||||
return obj
|
||||
}
|
||||
|
||||
type PostTags struct {
|
||||
Id int
|
||||
Post *Post `orm:"rel(fk)"`
|
||||
Tag *Tag `orm:"rel(fk)"`
|
||||
}
|
||||
|
||||
func (m *PostTags) TableName() string {
|
||||
return "prefix_post_tags"
|
||||
}
|
||||
|
||||
type Comment struct {
|
||||
Id int
|
||||
Post *Post `orm:"rel(fk);column(post)"`
|
||||
|
Reference in New Issue
Block a user