Backend: Refactor person entity #98 #144

Database column types are now UPPERCASE so that developers can easily recognize them. After upgrading to GORM 2.0, we can use generic types instead.

Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
Michael Mayer
2020-09-13 17:51:43 +02:00
parent 768f9b3064
commit 84b17194af
23 changed files with 158 additions and 183 deletions

View File

@@ -19,11 +19,11 @@ type Label struct {
LabelUID string `gorm:"type:varbinary(42);unique_index;" json:"UID" yaml:"UID"`
LabelSlug string `gorm:"type:varbinary(255);unique_index;" json:"Slug" yaml:"-"`
CustomSlug string `gorm:"type:varbinary(255);index;" json:"CustomSlug" yaml:"-"`
LabelName string `gorm:"type:varchar(255);" json:"Name" yaml:"Name"`
LabelPriority int `gorm:"type:varchar(255);" json:"Priority" yaml:"Priority,omitempty"`
LabelFavorite bool `gorm:"type:varchar(255);" json:"Favorite" yaml:"Favorite,omitempty"`
LabelDescription string `gorm:"type:text;" json:"Description" yaml:"Description,omitempty"`
LabelNotes string `gorm:"type:text;" json:"Notes" yaml:"Notes,omitempty"`
LabelName string `gorm:"type:VARCHAR(255);" json:"Name" yaml:"Name"`
LabelPriority int `gorm:"type:VARCHAR(255);" json:"Priority" yaml:"Priority,omitempty"`
LabelFavorite bool `gorm:"type:VARCHAR(255);" json:"Favorite" yaml:"Favorite,omitempty"`
LabelDescription string `gorm:"type:TEXT;" json:"Description" yaml:"Description,omitempty"`
LabelNotes string `gorm:"type:TEXT;" json:"Notes" yaml:"Notes,omitempty"`
LabelCategories []*Label `gorm:"many2many:categories;association_jointable_foreignkey:category_id" json:"-" yaml:"-"`
PhotoCount int `gorm:"default:1" json:"PhotoCount" yaml:"-"`
CreatedAt time.Time `json:"CreatedAt" yaml:"-"`