feat: news router

This commit is contained in:
ericprd
2025-03-02 04:36:17 +08:00
parent f4ae93bc48
commit 915f12eaf7
49 changed files with 863 additions and 132 deletions
+18 -2
View File
@@ -36,6 +36,18 @@ func NewDB() (*DB, error) {
return &DB{db}, nil
}
func (db *DB) DropTables() error {
// Auto Migrate the User model
return db.Migrator().DropTable(
// &Staff{},
// &SubscribePlan{},
// &Subscribe{},
// &User{},
&Tag{},
&Category{},
&News{},
)
}
func (db *DB) Migrate() error {
// Auto Migrate the User model
return db.AutoMigrate(
@@ -43,7 +55,11 @@ func (db *DB) Migrate() error {
&SubscribePlan{},
&Subscribe{},
&User{},
&Tag{},
&Category{},
// &Tag{},
// &Category{},
// &News{},
&NewsModel{},
&TagModel{},
&CategoryModel{},
)
}