35 lines
664 B
Go
35 lines
664 B
Go
|
package model
|
||
|
|
||
|
import (
|
||
|
"github.com/loveuer/nf-disk/internal/opt"
|
||
|
"gorm.io/gorm"
|
||
|
"gorm.io/gorm/clause"
|
||
|
)
|
||
|
|
||
|
func Init(tx *gorm.DB) (err error) {
|
||
|
err = tx.AutoMigrate(
|
||
|
&Connection{},
|
||
|
)
|
||
|
|
||
|
if opt.Debug {
|
||
|
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: "5VCR05L4BSGNCTCD8DXP",
|
||
|
Key: "FPTMYBEiHhWLJ05C3aGXW8bjFXXNmghc8Za3Fo2u",
|
||
|
},
|
||
|
}).Clauses(clause.OnConflict{
|
||
|
DoNothing: true,
|
||
|
}).Error
|
||
|
}
|
||
|
|
||
|
return
|
||
|
}
|