refactor: 移除 TryCreateTable 函数,简化 GORM 数据库操作

This commit is contained in:
lixiangwuxian 2025-07-15 20:23:35 +08:00
parent 5b7f4b2118
commit 2f7968d680

View File

@ -26,11 +26,6 @@ func GetGormDB() *gorm.DB {
return db return db
} }
// TryCreateTable 使用GORM执行原始SQL创建表语句
func TryCreateTable(query string) error {
return GetGormDB().Exec(query).Error
}
// AutoMigrate 使用GORM的自动迁移功能 // AutoMigrate 使用GORM的自动迁移功能
func AutoMigrate(models ...interface{}) error { func AutoMigrate(models ...interface{}) error {
return GetGormDB().AutoMigrate(models...) return GetGormDB().AutoMigrate(models...)