fix(database): pool model
This commit is contained in:
parent
ef31399ab6
commit
104c148eb8
@ -9,8 +9,10 @@ const (
|
|||||||
|
|
||||||
type Pool struct {
|
type Pool struct {
|
||||||
BaseModel[PoolID]
|
BaseModel[PoolID]
|
||||||
Name string `json:"name" gorm:"type:varchar(25)"`
|
Name string `json:"name" gorm:"column:name;type:varchar(25)"`
|
||||||
Category PoolCategory `json:"category" gorm:"type:pool_category;type:enum('series', 'collection')"`
|
Category PoolCategory `json:"category" gorm:"column:category;type:pool_category;type:enum('series', 'collection')"`
|
||||||
|
Posts []PoolPost `json:"posts" gorm:"foreignKey:PoolID"`
|
||||||
|
Sources []PoolReference `json:"sources" gorm:"foreignKey:PoolID"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Pool) TableName() string {
|
func (Pool) TableName() string {
|
||||||
@ -18,11 +20,10 @@ func (Pool) TableName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PoolPost struct {
|
type PoolPost struct {
|
||||||
Pool Pool `json:"pool" gorm:"foreignKey:ID;references:PoolID"`
|
PoolID PoolID `json:"pool_id" gorm:"column:pool_id;primaryKey"`
|
||||||
PoolID PoolID `json:"pool_id" gorm:""`
|
Pool Pool `json:"-"`
|
||||||
Post Post `json:"post" gorm:"foreignKey:ID;references:PostID"`
|
PostID PostID `json:"post_id" gorm:"column:post_id;primaryKey"`
|
||||||
PostID PostID `json:"post_id" gorm:""`
|
OrderPosition int `json:"order_position" gorm:"column:order_position;default:0"`
|
||||||
OrderPosition int `json:"order_position" gorm:"not null;default:0"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (PoolPost) TableName() string {
|
func (PoolPost) TableName() string {
|
||||||
@ -30,11 +31,10 @@ func (PoolPost) TableName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PoolReference struct {
|
type PoolReference struct {
|
||||||
Pool Pool `json:"pool" gorm:"foreignKey:ID;references:PoolID"`
|
PoolID PoolID `json:"pool_id" gorm:"column:pool_id;primaryKey"`
|
||||||
PoolID PoolID `json:"pool_id" gorm:""`
|
Pool Pool `json:"-"`
|
||||||
Source Source `json:"source" gorm:"foreignKey:ID;references:SourceID"`
|
SourceID SourceID `json:"source_id" gorm:"column:source_id;primaryKey"`
|
||||||
SourceID SourceID `json:"source_id" gorm:""`
|
URL string `json:"url" gorm:"column:url;primaryKey"`
|
||||||
URL string `json:"url" gorm:"not null"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (PoolReference) TableName() string {
|
func (PoolReference) TableName() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user