-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Regression of purging user due to fkey constraint of main_access_key
#1775
Merged
Conversation
This file contains 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
fregataa
added
the
skip:changelog
Make the action workflow to skip towncrier check
label
Dec 11, 2023
github-actions
bot
added
comp:manager
Related to Manager component
require:db-migration
Automatically set when alembic migrations are added or updated
size:M
30~100 LoC
labels
Dec 11, 2023
fregataa
requested review from
achimnol and
kyujin-cho
and removed request for
achimnol
December 11, 2023 12:19
fregataa
requested review from
achimnol and
gee05053
and removed request for
kyujin-cho
December 11, 2023 12:28
5 tasks
achimnol
changed the title
fix: enable to delete users
fix: Regression of purging user due to fkey constraint of Dec 15, 2023
main_access_key
kyujin-cho
approved these changes
Jan 11, 2024
Comment on lines
631
to
638
user_query = sa.select(UserRow.uuid).where(UserRow.main_access_key == access_key) | ||
uuid_list: list[str] = [ | ||
str(raw_uuid) for raw_uuid in (await db_session.scalars(user_query)).all() | ||
] | ||
if uuid_list: | ||
return DeleteKeyPair( | ||
False, f"the keypair is used as main access key by user(uuid: {uuid_list})" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like these lines can be simplified by just evaluating result of COUNT(*)
query, as the purpose of this block is to check if the user is utilizing this keypair as its main keypair.
fregataa
added a commit
that referenced
this pull request
Jan 11, 2024
…s_key` (#1775) Backported-from: main Backported-to: 23.09
7 tasks
kyujin-cho
pushed a commit
that referenced
this pull request
Feb 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
comp:manager
Related to Manager component
require:db-migration
Automatically set when alembic migrations are added or updated
size:M
30~100 LoC
skip:changelog
Make the action workflow to skip towncrier check
urgency:blocker
IT SHOULD BE RESOLVED BEFORE NEXT RELEASE!
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.
follow-up #1761
The
main_access_key
foreign key hasondelete=RESTRICT
constraint, which disallow to delete any user record.Replace the
ondelete
constraint on themain_access_key
foreign key withSET NULL
because the existing implementation deleteskeypair
record before deletinguser
.Checklist: (if applicable)