Compare commits

..

No commits in common. "d5f0d3ee8c884386acccfd7f73f381aef91fde53" and "ef31399ab61cd9fea36232e30c08ee0e659484b7" have entirely different histories.

2 changed files with 12 additions and 25 deletions

View File

@ -1,13 +0,0 @@
-- +migrate Up
ALTER TABLE "PostReference"
ALTER COLUMN post_id TYPE CHAR(25),
ALTER COLUMN source_id TYPE CHAR(25);
ALTER TABLE post_tags
ALTER COLUMN post_id TYPE CHAR(25);
ALTER TABLE "UserFavorites"
ALTER COLUMN post_id TYPE CHAR(25);
ALTER TABLE "UserSource"
ALTER COLUMN source_id TYPE CHAR(25);

View File

@ -9,10 +9,8 @@ const (
type Pool struct { type Pool struct {
BaseModel[PoolID] BaseModel[PoolID]
Name string `json:"name" gorm:"column:name;type:varchar(25)"` Name string `json:"name" gorm:"type:varchar(25)"`
Category PoolCategory `json:"category" gorm:"column:category;type:pool_category;type:enum('series', 'collection')"` Category PoolCategory `json:"category" gorm:"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 {
@ -20,10 +18,11 @@ func (Pool) TableName() string {
} }
type PoolPost struct { type PoolPost struct {
PoolID PoolID `json:"pool_id" gorm:"column:pool_id;primaryKey"` Pool Pool `json:"pool" gorm:"foreignKey:ID;references:PoolID"`
Pool Pool `json:"-"` PoolID PoolID `json:"pool_id" gorm:""`
PostID PostID `json:"post_id" gorm:"column:post_id;primaryKey"` Post Post `json:"post" gorm:"foreignKey:ID;references:PostID"`
OrderPosition int `json:"order_position" gorm:"column:order_position;default:0"` PostID PostID `json:"post_id" gorm:""`
OrderPosition int `json:"order_position" gorm:"not null;default:0"`
} }
func (PoolPost) TableName() string { func (PoolPost) TableName() string {
@ -31,10 +30,11 @@ func (PoolPost) TableName() string {
} }
type PoolReference struct { type PoolReference struct {
PoolID PoolID `json:"pool_id" gorm:"column:pool_id;primaryKey"` Pool Pool `json:"pool" gorm:"foreignKey:ID;references:PoolID"`
Pool Pool `json:"-"` PoolID PoolID `json:"pool_id" gorm:""`
SourceID SourceID `json:"source_id" gorm:"column:source_id;primaryKey"` Source Source `json:"source" gorm:"foreignKey:ID;references:SourceID"`
URL string `json:"url" gorm:"column:url;primaryKey"` SourceID SourceID `json:"source_id" gorm:""`
URL string `json:"url" gorm:"not null"`
} }
func (PoolReference) TableName() string { func (PoolReference) TableName() string {