Просмотр исходного кода

hard delete installation records

Ivan Galakhov 4 лет назад
Родитель
Сommit
0f11380b4e
2 измененных файлов с 2 добавлено и 2 удалено
  1. 1 1
      internal/repository/gorm/auth.go
  2. 1 1
      server/api/integration_handler.go

+ 1 - 1
internal/repository/gorm/auth.go

@@ -1126,7 +1126,7 @@ func (repo *GithubAppInstallationRepository) ReadGithubAppInstallationByAccountI
 }
 
 func (repo *GithubAppInstallationRepository) DeleteGithubAppInstallationByAccountID(accountID int64) error {
-	if err := repo.db.Where("account_id = ?", accountID).Delete(ints.GithubAppInstallation{}).Error; err != nil {
+	if err := repo.db.Unscoped().Where("account_id = ?", accountID).Delete(&ints.GithubAppInstallation{}).Error; err != nil {
 		return err
 	}
 

+ 1 - 1
server/api/integration_handler.go

@@ -401,7 +401,7 @@ func (app *App) HandleGithubAppEvent(w http.ResponseWriter, r *http.Request) {
 			_, err := app.Repo.GithubAppInstallation.ReadGithubAppInstallationByAccountID(*e.Installation.Account.ID)
 
 			if err != nil && err == gorm.ErrRecordNotFound {
-				// insert account/installation pair into databse
+				// insert account/installation pair into database
 				_, err := app.Repo.GithubAppInstallation.CreateGithubAppInstallation(&ints.GithubAppInstallation{
 					AccountID:      *e.Installation.Account.ID,
 					InstallationID: *e.Installation.ID,