[feat-5517]: Add Delete API for Scope configs#5558
Merged
Conversation
5345af0 to
9eeb5b6
Compare
klesh
reviewed
Jun 25, 2023
added 6 commits
June 25, 2023 12:06
klesh
reviewed
Jun 26, 2023
| if scopeModel == nil { | ||
| return nil | ||
| } | ||
| return t.db.Exec(fmt.Sprintf("UPDATE %s SET scope_config_id = NULL WHERE scope_config_id = %d", scopeModel.TableName(), scopeConfigId)) |
Contributor
There was a problem hiding this comment.
I think we can pass the scopeModel to the db.Delete in conjunction with dal.Where clause in this case. It is preferable to use db.Delete since we can add hook to the gorm when we need to.
Contributor
Author
There was a problem hiding this comment.
The problem is with Dynamic structs that we use for Python. Gorm doesn't play nicely with them, especially with update operations.
Contributor
There was a problem hiding this comment.
Sorry for the typo, it should be db.Update.
Alright then, let's add a comment to it to avoid mis-edit
Contributor
Author
There was a problem hiding this comment.
Turns out that there's a dal.UpdateColumn method that also get the job done (without writing raw sql). I've updated the code to use that.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What does this PR do?
Does this close any open issues?
Closes #5517
Screenshots
Include any relevant screenshots here.
Other Information
New API added for all plugins supporting scope-configs:
DELETE /plugins/{plugin-name}/connections/{connection-id}/scope-configs/{config-scope-id}cc FYI @mintsweet (For UI)