8000 Add twoWayKey checks and multiple many-to-many restrictions by fogelito · Pull Request #7153 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add twoWayKey checks and multiple many-to-many restrictions #7153

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

Merged
merged 9 commits into from
Feb 25, 2024

Conversation

fogelito
Copy link
Contributor

Fix for relations attributes when twoWayKey variable is not passed in API,
We do not want the worker to throw the Error
Until now, it was checked only for twoWay = true

Added a validation to prevent the creation of 2 manyToMany relations between the same collections

#6281

@fogelito fogelito changed the base branch from main to 1.4.x November 16, 2023 13:58
@fogelito fogelito mentioned this pull request Nov 16, 2023
@stnguyen90 stnguyen90 changed the title TwoWayKeya checks and multiple Many2Many restrictions Add twoWayKey checks and multiple many-to-many restrictions Nov 21, 2023
@fogelito fogelito changed the base branch from 1.4.x to 1.5.x January 30, 2024 08:27
Comment on lines 1682 to 1689
if (
$type === Database::RELATION_MANY_TO_MANY &&
$attribute->getAttribute('type') === Database::VAR_RELATIONSHIP &&
$attribute->getAttribute('options')['relationType'] === Database::RELATION_MANY_TO_MANY &&
$attribute->getAttribute('options')['relatedCollection'] === $relatedCollection->getId()
) {
throw new Exception(Exception::ATTRIBUTE_ALREADY_EXISTS, 'Creating more than one "manyToMany" relationship on the same collection is currently not permitted.');
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to address #6887? If so, i think it should be a separate PR linked to that #6887. We should probably improve these junction tables to:

  1. properly allow multiple
  2. make sure they work with multiple databases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently we do not have this option in Utopia , Definitely something to improve in the future.
The issue you mention here sounds like the reason we are restricting this for now.

@abnegate abnegate merged commit ff26d4c into 1.5.x Feb 25, 2024
@abnegate abnegate deleted the twoWayKey-2 branch February 25, 2024 09:44
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.

3 participants
0