MCPcopy Create free account
hub / github.com/OpenListTeam/OpenList / AutoMigrate

Function AutoMigrate

internal/db/db.go:21–29  ·  view source on GitHub ↗
(dst ...interface{})

Source from the content-addressed store, hash-verified

19}
20
21func AutoMigrate(dst ...interface{}) error {
22 var err error
23 if conf.Conf.Database.Type == "mysql" {
24 err = db.Set("gorm:table_options", "ENGINE=InnoDB CHARSET=utf8mb4").AutoMigrate(dst...)
25 } else {
26 err = db.AutoMigrate(dst...)
27 }
28 return err
29}
30
31func GetDb() *gorm.DB {
32 return db

Callers 1

InitFunction · 0.85

Calls 1

SetMethod · 0.45

Tested by

no test coverage detected