-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Autoincrement property is too mysql specific #5812
Comments
Hi @dtoubelis, regarding the attribute |
I like it! This would apply nicely to the sails-dynamodb adapter too, among others. What do you think of adding this to the 0.11 milestone, @particlebanana ? |
@dmarcelino: I actually have |
And that can be seen here: https://github.com/balderdashy/waterline/blob/7aa74cb8fd61407c2bc6391cab7db81932af4256/lib/waterline/core/schema.js#L126-L129 That said, I have had some luck implementing UUIDs using |
Thanks for posting, @dtoubelis. I'm a repo bot-- nice to meet you! It has been 60 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message. On the other hand, if you are still waiting on a patch, please:
Thanks so much for your help! |
Any plans on implementing this? |
I'm working on a
waterline-cassandra
adapter at https://github.com/dtoubelis/sails-cassandra and it looks to me thatautoIncrement
property is too restrictive. I think theautoIncrement
mechanism is too MySQL specific. Oracle and Postgres can use sequences, another option is using UUID. The problem is thatautoIncrement
attribute also enforces the field type tointeger
, however this is not the case with UUIDs and potentially sequences that can support values larger than 32-bit integer. So, here are few suggestions:autoIncrement
attribute enforcinginteger
type and leave it either up to developer or to the adapter to provide the correct type. Same is true for enforcingunique: true
. Even though it seems harmless, it unnecessarily interferes with developer's intent.autoincrement
feature with something more generic (maybe similar to Hibernate), for example:and make
autoIncrement: true
synonym toautoGenerated: {generator: 'native'}
for backward compatibility.This would make the interface more generic and more compatible with other data sources.
P.S.: The
autoGenerated
is not necessarily has to be property of a primary key. I think that any attribute should be allowed to have this property.The text was updated successfully, but these errors were encountered: