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

How to create one-to-one relation? #179

Open
pikhovkin opened this issue Feb 15, 2023 · 3 comments
Open

How to create one-to-one relation? #179

pikhovkin opened this issue Feb 15, 2023 · 3 comments
Labels
feature request Ask for new feature or feature evolution

Comments

@pikhovkin
Copy link

No description provided.

@loicknuchel
Copy link
Contributor

Hi @pikhovkin
We don't support defining the relation type as we try to be close to what is the database structure.
Yet, we discussed in #166 the possibility to show relations as one-to-one when they meet the criteria (link to a unique column).
Still not done yet but it's on our list.
What do you think about it?

@loicknuchel loicknuchel added the feature request Ask for new feature or feature evolution label Mar 6, 2023
@michi-zuri
Copy link

Hey @loicknuchel,

I was confused^1 by the criteria you mentioned above and probably misunderstood what you meant with link to a unique column. As I may not be the only person, here's a how I would name the criteria for showing a one-to-one relation:

  • foreign key constraint defined on/placed on/attached to a unique column^2
    or
  • link from a unique column^2

Would you agree? I'm sorry, I haven't gotten around to contribute any code to azimutt yet. It's on my bucket list of things to do before I die, but I have no idea when that will be. Keep up the great work!

^1: because foreign key constraints must point to a unique column^2, otherwise it's not a foreign key.
^2: or a unique column group enforced by a composite unique constraint

@loicknuchel
Copy link
Contributor

Hi @michi-zuri

You're right, I wrote too quickly, it's not a "link to a unique column" but a foreign key with a unique constraint.
In fact, both side of the relation should have a unique constraint, but it's often the case for the target as we link to primary keys ^^
On the "unique column group", you are right, but for now Azimutt handles composite unique constraints but not composite foreign keys (big refacto in the data model for this ^^).

Don't worry about your contribution ;)
You can do it when you have time and you can ping me if you need some help to get started.
++

@nameer nameer mentioned this issue Dec 12, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Ask for new feature or feature evolution
Projects
None yet
Development

No branches or pull requests

3 participants