Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Define column names #119

Closed
gustavohenke opened this Issue Sep 10, 2012 · 4 comments

Comments

Projects
None yet
4 participants

Hey,
Congratulations for jugglingdb, its the best ORM I found so far in Node.
However, I'm unable to find where to define a column name for each property, like in (N)Hibernate... for example:

  • The column id_user maps to ID
  • The column registration_date maps to registrationDate

Can I do this or, for now, It would be a new feature?
Thanks in advance.

Owner

1602 commented Sep 10, 2012

Thanks! Yep, it's a new feature, it should work with property settings
(like index, limit and others):

schema.define('Model', {
    ...
    propertyname: {type: String, columnName: 'col'}
    ...
});

On Mon, Sep 10, 2012 at 10:06 PM, Gustavo Henke notifications@github.comwrote:

Hey,
Congratulations for jugglingdb, its the best ORM I found so far in Node.
However, I'm unable to find where to define a column name for each
property, like in (N)Hibernate... for example:

  • The column id_user maps to ID
  • The column registration_date maps to registrationDate

Can I do this or, for now, It would be a new feature?
Thanks in advance.


Reply to this email directly or view it on GitHubhttps://github.com/1602/jugglingdb/issues/119.

Thanks,
Anatoliy Chakkaev

I'll fork jugglingdb and try to implement this in a few hours, unless it's something you can do very quickly :)

jihaia commented Aug 1, 2013

Outside of defining a different field as the primary key, can we ensure that we are limited to autoincrement/integer fields types. For example, many legacy systems have intelligent keys, GUIDs etc. I'm happy to help out, test etc.

Contributor

alexmingoia commented Aug 1, 2013

Yeah, I have some time this weekend to implement the custom field names on my fork. I'll issue a pull request when I've got something.

I'm going to go with columnName as the additional field on property definitions. Should this be something more generic for DBs that don't refer to "columns" like mongo?

@1602 1602 closed this in #312 Jan 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment