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

Remove name and uniqueness in redirect condition table #2035

Merged

Conversation

acelaya
Copy link
Member

@acelaya acelaya commented Feb 29, 2024

Part of #1914

During the implementation of the API to handle redirect rules and conditions, it was made obvious that a normalized version of rules<->relation_table<->conditions would not be as easy to handle, so I thought it would make more sense to switch from a many-to-many relationship to a one-to-many.

However, we want rules to know about conditions, but not the other way around, and Doctrine does not handle inversed unidirectional one-to-many relationships so well.

Because of that, this keeps the many-to-many relationship, but refactoring it so that conditions are not unique nor shared between rules anymore. Instead, every rule will have its conditions, that will be removed when orphaned.

That requires removing the name filed from conditions, which acted as a unique key, and making conditions to cascade persist, as they will always be created together with "their" rule.

@acelaya acelaya mentioned this pull request Feb 29, 2024
8 tasks
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.19%. Comparing base (ab7824a) to head (070d748).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2035      +/-   ##
=============================================
- Coverage      97.20%   97.19%   -0.01%     
  Complexity      1317     1317              
=============================================
  Files            245      245              
  Lines           4578     4571       -7     
=============================================
- Hits            4450     4443       -7     
  Misses           128      128              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acelaya acelaya merged commit a7cde93 into shlinkio:develop Feb 29, 2024
23 checks passed
@acelaya acelaya deleted the feature/improve-rules-persistence branch February 29, 2024 08:26
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.

None yet

1 participant