From 7aac3a610614d7115976a45d2dd33fdd479e96ff Mon Sep 17 00:00:00 2001
From: barnett <zengqg@goodrain.com>
Date: Thu, 19 Apr 2018 17:04:23 +0800
Subject: [PATCH] [REV] update delete plugin env code ,add tx

---
 pkg/api/handler/service_plugin.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/api/handler/service_plugin.go b/pkg/api/handler/service_plugin.go
index fe2a279f1b..06bdced9d5 100644
--- a/pkg/api/handler/service_plugin.go
+++ b/pkg/api/handler/service_plugin.go
@@ -261,7 +261,7 @@ func (s *ServiceAction) UpdateVersionEnv(uve *api_model.SetVersionEnv) *util.API
 }
 
 func (s *ServiceAction) upNormalEnvs(tx *gorm.DB, uve *api_model.SetVersionEnv) *util.APIHandleError {
-	err := db.GetManager().TenantPluginVersionENVDao().DeleteEnvByPluginID(uve.Body.ServiceID, uve.PluginID)
+	err := db.GetManager().TenantPluginVersionENVDaoTransactions(tx).DeleteEnvByPluginID(uve.Body.ServiceID, uve.PluginID)
 	if err != nil {
 		if err != gorm.ErrRecordNotFound {
 			return util.CreateAPIHandleErrorFromDBError("delete version env", err)