wip: conn list
This commit is contained in:
@ -1,9 +1,34 @@
|
||||
package model
|
||||
|
||||
import "gorm.io/gorm"
|
||||
import (
|
||||
"github.com/loveuer/nf-disk/internal/opt"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
func Init(tx *gorm.DB) error {
|
||||
return tx.AutoMigrate(
|
||||
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
|
||||
}
|
||||
|
Reference in New Issue
Block a user