db/database.go
@@ -1,10 +1,11 @@ package db import ( "time" "gorm.io/driver/mysql" "gorm.io/gorm" "ruleModelEngine/config" "time" ) var DB *gorm.DB @@ -34,6 +35,13 @@ sqlDb.SetMaxOpenConns(1) sqlDb.SetConnMaxLifetime(time.Duration(120) * time.Second) sqlDb.SetConnMaxIdleTime(time.Duration(1800) * time.Second) db.AutoMigrate( &PublicHouse{}, &PersonnelStatusRule{}, &Task{}, ) DB = db return nil }