36 lines
597 B
Go
Raw Normal View History

2024-09-27 14:52:10 +08:00
package model
2024-09-29 22:15:28 +08:00
import (
"github.com/loveuer/nf-disk/internal/opt"
"gorm.io/gorm"
)
2024-09-27 14:52:10 +08:00
2024-09-29 22:15:28 +08:00
func Init(tx *gorm.DB) (err error) {
if err = tx.AutoMigrate(
2024-09-27 14:52:10 +08:00
&Connection{},
2024-09-29 22:15:28 +08:00
); err != nil {
return err
}
if opt.Debug {
if err = tx.Create([]*Connection{
{
Name: "dev-minio",
Endpoint: "http://10.220.10.15:9000",
Access: "8ALV3DUZI31YG4BDRJ0Z",
Key: "CRqwS1MsiUj27TbRK+3T2n+LpKWd07VvaDKuzU0H",
},
{
Name: "test",
Endpoint: "http://10.220.10.14:19000",
Access: "",
Key: "",
},
}).Error; err != nil {
return err
}
}
return
2024-09-27 14:52:10 +08:00
}