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
Feature Request: GUIDs as Primary Keys #6369
Comments
It looks like you can specify a primary key, and manually create GUIDs from your application and set those to the respective column. It seems to work just fine. Here's what I did: I used the node-uuid module (https://github.com/broofa/node-uuid):
Then in the model where I wanted to use GUIDs, I just set
Also, I set |
We're closing this to keep things tidy. It has been tracked as a feature request. Thanks for sharing your ideas and feedback. And, as always, you can reopen an issue at any time if you need more support. |
One important note for others that grab @glenselle's helpful snippet above. Make sure not to call the uuid.v4 function or else it will do it once at instantiation and use the same GUID for each new record.
|
@glenselle @mikebiglan +1 👍 |
(migrated from my original post in Sails)
I prefer to use GUIDs instead of integer primary keys in my apps, and I'd like to be able to do this within Sails. This is definitely lower priority than, say, associations, but I don't believe I'm the only one who uses this, either (see: http://www.codinghorror.com/blog/2007/03/primary-keys-ids-versus-guids.html).
The text was updated successfully, but these errors were encountered: