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 #1722: Cannot remove callbacks due to foreign key constraint #1728

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

jnpsk
Copy link
Collaborator

@jnpsk jnpsk commented Oct 4, 2024

Fix #1722 by adding enabled column to the pa_application_callback table for soft-delete purpose. When delete callback request is processed, a database record is not physically deleted anymore, instead enabled is set to false.

As @banterCZ suggested I tried @SQLRestriction("enabled = true") on the entity level, which applies filter to queries, basically appending "where enabled = true" to each query. So a disabled callback can't be listed, updated nor deleted repeatedly. The delete method on the repository is overridden to do an update instead. I added some tests for that.

@jnpsk jnpsk force-pushed the issues/1722-remove-callbacks branch from 4af9652 to f3990e8 Compare October 4, 2024 13:54
Copy link
Member

@romanstrobl romanstrobl left a comment

Choose a reason for hiding this comment

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

Nice solution!

Copy link
Member

@banterCZ banterCZ left a comment

Choose a reason for hiding this comment

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

A great soft-delete functionality!

@jnpsk jnpsk merged commit cccd79a into develop Oct 8, 2024
2 checks passed
@jnpsk jnpsk deleted the issues/1722-remove-callbacks branch October 8, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot remove callbacks due to foreign key constraint
3 participants