Allow primary keys to be foreign key #9331
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As discussed with @mike12345567 I removed the foreign key relationship filter to allow primary keys to act as foreign keys.
This is to satisfy a fairly common use-case, as per this docs tutorial I'm working on: https://docs.budibase.com/docs/mysql-mariadb
Addresses:
Screenshots
employees table
![Screenshot 2023-01-12 at 17 08 21](https://user-images.githubusercontent.com/101575380/212133266-2da8f66c-3739-4ab3-aa96-f5e8f179e7ae.png)
titles table
![Screenshot 2023-01-12 at 17 08 44](https://user-images.githubusercontent.com/101575380/212133334-dec111ba-72b4-44c2-8c55-34b4c3e92366.png)
Define existing relationship - can now use the emp_no column, even though it is primary
![Screenshot 2023-01-12 at 17 09 19](https://user-images.githubusercontent.com/101575380/212133457-ef86d4f5-5f38-413e-a599-2afec6d9dd4d.png)
Result
![Screenshot 2023-01-12 at 17 10 28](https://user-images.githubusercontent.com/101575380/212133722-11aa4eb4-5566-4f3a-80f7-50ddcbe762f5.png)