refactor: 移除 TryCreateTable 函数,简化 GORM 数据库操作
This commit is contained in:
parent
5b7f4b2118
commit
2f7968d680
@ -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...)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user