8000 Deal with the "FK can not be a (part of a) PK" issue · Issue #7 · fuelphp-storage/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Deal with the "FK can not be a (part of a) PK" issue #7

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

Open
WanWizard opened this issue Aug 23, 2013 · 3 comments
Open

Deal with the "FK can not be a (part of a) PK" issue #7

WanWizard opened this issue Aug 23, 2013 · 3 comments

Comments

@WanWizard
Copy link
Contributor

No description provided.

@emlynwest
Copy link
Contributor

How do we handle this? We can either leave it as it is currently and make a note that you should not be using a FK as a PK in your DBMS or we do not update the FK on changes to the relation. The both could cause issues, the latter especially so as it might lead some items to become "re-related" to new parent models.

@WanWizard
Copy link
Contributor Author

From the database and/or normalisation point of view this is not a problem, but there are some restrictions to what you can do with it.

Consider:

  • table A, PK columnA
  • table B, PK columnB
  • table C, compound PK (columnA, columnB)
  • one-to-many between C and A, and between C and B

This should be possible, but may require a forced cascade-delete (in v1 terms), since you can not allow one of the table C PK columns to become NULL.

@emlynwest
Copy link
Contributor

Ah I see, so it's making sure the database stays consistent with what is actually happening when relations are changed.

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

No branches or pull requests

2 participants
0