package models

import (
	"git.apinb.com/bsm-sdk/core/database"
	"git.apinb.com/bsm-sdk/core/types"
	"gorm.io/gorm"
)

// CmsAccessory 文章附件表
type CmsAccessory struct {
	gorm.Model
	types.Std_Identity
	PostId        uint   `gorm:"column:post_id;not null" json:"post_id"`                              // 关联文章id
	PostIdentity  string `gorm:"column:post_identity;type:varchar(36);index;" json:"post_identity"`   // 关联文章标识
	PagesId       uint   `gorm:"column:pages_id;not null" json:"pages_id"`                            // 关联文章页面id
	PagesIdentity string `gorm:"column:pages_identity;type:varchar(36);index;" json:"pages_identity"` //  关联文章页面标识
	Title         string `gorm:"column:title;type:varchar(255);default:''" json:"title"`              // 附件标题
	FilePath      string `gorm:"column:file_path;type:varchar(500);not null" json:"file_path"`        // 附件文件地址
}

func init() {
	database.MigrateTables = append(database.MigrateTables, &CmsAccessory{})
}

// TableName .CmsAccessory 分类表
func (c *CmsAccessory) TableName() string {
	return "cms_accessory" // 对应数据库表名
}
