优化
This commit is contained in:
@@ -56,15 +56,7 @@ func (r *initializationRepo) ReloadConfig(ctx context.Context) error {
|
||||
}
|
||||
|
||||
func (r *initializationRepo) IsInitialized(ctx context.Context) (bool, error) {
|
||||
db := r.data.gormDB.WithContext(ctx)
|
||||
if !db.Migrator().HasTable(&userPO{}) {
|
||||
return false, nil
|
||||
}
|
||||
var count int64
|
||||
if err := db.Model(&userPO{}).Where("username = ?", "admin").Count(&count).Error; err != nil {
|
||||
return false, err
|
||||
}
|
||||
return count > 0, nil
|
||||
return r.data.databaseReady.Load(), nil
|
||||
}
|
||||
|
||||
func (r *initializationRepo) Initialize(ctx context.Context, input *biz.DatabaseConfig) error {
|
||||
|
||||
Reference in New Issue
Block a user