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
Composite Primary Key Support #1664
Comments
Just discovered this while migrating an existing postgres schema to Bookshelf. Is there a best practice pattern / workaround for handling composite primary keys? All I could find is that you have to override |
@bgerd I am trying that on the latest versions of both By the way, this feature is a must. Without that bookshelf is dying: you can't upgrade your dependencies to the latest versions w/o composite PKs |
If it doesn't support composite keys, how on earth does it claim to support Many-to-Many? |
Bookshelf assumes (wrongly) that a pivot table HAS to have an "id attribute", when most pivot tables are composed with the primary keys of the individual entities in your many-to-many relation. I am baffled this is still an issue, since I have been reading about it for 3 years. If anyone is reading this : my solution to this problem was to create an "ID" field on my table, set on auto_increment with a UNIQUE index. |
Composite Primary Keys
Related Issues:
I searched for all issues that reference composite primary keys in some way. Most of these are directly issues resulting from our lack of composite key support. Some only indirectly involve composite keys.
attach
with additional attributes #29Introduction
Composite or Compound primary keys are used when a single column value is not enough to define the unique ID of a record on some table. These are widely used, especially in the context of multi-tenant applications. There have been many calls for implementation of composite primary keys.
The text was updated successfully, but these errors were encountered: