feat: add description field to Category model and clean up migration code
This commit is contained in:
parent
dc1a4dafbc
commit
479703dfd0
@ -8,6 +8,7 @@ type Category struct {
|
|||||||
ID string `gorm:"primaryKey" json:"id"`
|
ID string `gorm:"primaryKey" json:"id"`
|
||||||
Name string `gorm:"not null" json:"name"`
|
Name string `gorm:"not null" json:"name"`
|
||||||
Code string `gorm:"not null;unique" json:"code"`
|
Code string `gorm:"not null;unique" json:"code"`
|
||||||
|
Description string `gorm:"default:null" json:"description"`
|
||||||
Sequence int `gorm:"default:null" json:"sequence"`
|
Sequence int `gorm:"default:null" json:"sequence"`
|
||||||
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"created_at"`
|
||||||
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP" json:"updated_at"`
|
||||||
|
|||||||
@ -39,10 +39,6 @@ func NewDB(cfg *config.Config) (*DB, error) {
|
|||||||
func (db *DB) DropTables() error {
|
func (db *DB) DropTables() error {
|
||||||
// Auto Migrate the User model
|
// Auto Migrate the User model
|
||||||
return db.Migrator().DropTable(
|
return db.Migrator().DropTable(
|
||||||
// &Staff{},
|
|
||||||
// &SubscribePlan{},
|
|
||||||
// &Subscribe{},
|
|
||||||
// &User{},
|
|
||||||
&Tag{},
|
&Tag{},
|
||||||
&Category{},
|
&Category{},
|
||||||
&News{},
|
&News{},
|
||||||
@ -55,9 +51,6 @@ func (db *DB) Migrate() error {
|
|||||||
&SubscribePlan{},
|
&SubscribePlan{},
|
||||||
&Subscribe{},
|
&Subscribe{},
|
||||||
&User{},
|
&User{},
|
||||||
// &Tag{},
|
|
||||||
// &Category{},
|
|
||||||
// &News{},
|
|
||||||
&News{},
|
&News{},
|
||||||
&Tag{},
|
&Tag{},
|
||||||
&Category{},
|
&Category{},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user