fix: only master node can migrate database

This commit is contained in:
JustSong
2023-06-22 00:52:27 +08:00
parent 1f3b3ca7ae
commit 567916bd80
2 changed files with 6 additions and 0 deletions

View File

@@ -55,6 +55,9 @@ func InitDB() (err error) {
}
if err == nil {
DB = db
if !common.IsMasterNode {
return nil
}
err := db.AutoMigrate(&Channel{})
if err != nil {
return err