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

Use database transactions #169

Open
riggraz opened this issue Oct 25, 2022 · 0 comments
Open

Use database transactions #169

riggraz opened this issue Oct 25, 2022 · 0 comments
Labels
refactoring Refactoring, cleanups, technical debt reduction ruby Issues that require ruby knowledge and pull requests that update Ruby code
Milestone

Comments

@riggraz
Copy link
Collaborator

riggraz commented Oct 25, 2022

There are a few places where multiple database operations that must be executed together are not under transaction:

  • Automatic insert of Follow when creating a new Post (posts_controller.rb, action create)
  • Automatic insert of PostStatusChange when updating a Post (posts_controller.rb, action update)

Put these operations under transaction so that, if one of them fails, everything is reverted back. Consider putting the logic in a workflow (see app/workflows for examples) to avoid cluttering the controllers too much.

@riggraz riggraz added ruby Issues that require ruby knowledge and pull requests that update Ruby code refactoring Refactoring, cleanups, technical debt reduction labels Oct 25, 2022
@riggraz riggraz added this to the v 1.0 milestone Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactoring, cleanups, technical debt reduction ruby Issues that require ruby knowledge and pull requests that update Ruby code
Projects
None yet
Development

No branches or pull requests

1 participant