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

Redifine the default 'id' field? #46

Closed
cliftonc opened this issue Mar 13, 2011 · 2 comments
Closed

Redifine the default 'id' field? #46

cliftonc opened this issue Mar 13, 2011 · 2 comments
Milestone

Comments

@cliftonc
Copy link

Hi,

Love your library, am definitely going to start using it, and as I figure out how it works hopefully contribute something back ;)

Quick q. - would it be possible to enable over-ride of the identifier? e.g. I want to retrofit this against an existing database, I can't do that if that existing database has a different naming convention for the identifier field.

Thanks!
Clifton

@sdepold
Copy link
Member

sdepold commented Apr 13, 2011

OK here are some lines of testcode, which might be interesting for you:

https://github.com/sdepold/sequelize/blob/rewrite/test/Sequelize/define.js#L30
https://github.com/sdepold/sequelize/blob/rewrite/test/Sequelize/define.js#L36
https://github.com/sdepold/sequelize/blob/rewrite/test/Model/find-findAll-all.js#L63

At this very moment, the rewrite version allows you to specify an attribute as primary key using the flag primaryKey: true.
If one primaryKey is defined manually, sequelize will not add an id column. Please let me know, what you think and if that solves your problem.

@cliftonc
Copy link
Author

Excellent - should do the trick, let me test it out and I'll get back to you.

@sdepold sdepold closed this as completed May 3, 2011
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