Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 409cb53e8c | |||
| 404957f16a | |||
| 3d6871138a |
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
var (
|
||||
// MigrateTables 存储需要在数据库初始化时自动迁移的表
|
||||
MigrateTables []any = []any{}
|
||||
MigrateTables []any
|
||||
)
|
||||
|
||||
// NewDatabase 根据提供的驱动类型创建新的数据库连接
|
||||
@@ -138,5 +138,8 @@ func NewPostgres(dsn []string, options *types.SqlOptions) (gormDb *gorm.DB, err
|
||||
//
|
||||
// - table: 需要自动迁移的表
|
||||
func AppendMigrate(table any) {
|
||||
if MigrateTables == nil {
|
||||
MigrateTables = make([]any, 0)
|
||||
}
|
||||
MigrateTables = append(MigrateTables, table)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user