Skip to content
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: Update ROM deletion process to remove associated collections #1345

Merged
merged 2 commits into from
Dec 5, 2024

Conversation

zurdi15
Copy link
Member

@zurdi15 zurdi15 commented Dec 5, 2024

No description provided.

@zurdi15 zurdi15 self-assigned this Dec 5, 2024
@zurdi15 zurdi15 changed the title feat: update ROM deletion process to remove associated collections fix: update ROM deletion process to remove associated collections Dec 5, 2024
@zurdi15 zurdi15 force-pushed the fix/update-collection-on-rom-delete branch from 187da44 to 014427e Compare December 5, 2024 16:08
@zurdi15 zurdi15 requested a review from gantoine December 5, 2024 16:09
@zurdi15 zurdi15 requested a review from adamantike December 5, 2024 16:09
@zurdi15 zurdi15 added the bug Something isn't working label Dec 5, 2024
@zurdi15 zurdi15 changed the title fix: update ROM deletion process to remove associated collections fix: Update ROM deletion process to remove associated collections Dec 5, 2024
Copy link

github-actions bot commented Dec 5, 2024

Test Results

88 tests   88 ✅  26s ⏱️
 1 suites   0 💤
 1 files     0 ❌

Results for commit c6039cc.

♻️ This comment has been updated with latest results.

collection.roms = [rom_id for rom_id in collection.roms if rom_id != id]
db_collection_handler.update_collection(
collection.id, {"roms": collection.roms}
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this instead happen in db_rom_handler.delete_rom as a side-effect?

Copy link
Member Author

@zurdi15 zurdi15 Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm idk, I stick to the idea of just interacting with one table per handler, but idk if that's the best approach

@adamantike
Copy link
Collaborator

The current solution looks good. An improvement we can add in the future, to avoid any race conditions and make the update atomic, is to have add_roms/remove_roms method at the handler, and generate a single SQL statement for the operation.

@zurdi15 zurdi15 merged commit 7624b0e into master Dec 5, 2024
8 checks passed
@zurdi15 zurdi15 deleted the fix/update-collection-on-rom-delete branch December 5, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants