Skip to content

Clarify Column VS Attribute Terminology #14301

Open

Description

@ephys

I'd like to address a confusing part of Sequelize: field & fieldName

As far as I understand it, field typically (always?) refers to the name of a column, and fieldName refers to the name of an attribute (js side).

I'd like to propose to rename them to:

  • attributeName for the JS side.
  • columnName for the DBMS side.
const User = this.sequelize.define('User', {
  firstName: {
    type: DataType.STRING,
    field: 'first_name',
  },
});

Would become

const User = this.sequelize.define('User', {
  firstName: {
    type: DataType.STRING,
    columnName: 'first_name', // or just "column"?
  },
});

We'd implement this in v7, but field would continue working until v8 and log a deprecation warning.


In a similar vein, we should rename the often confusing underscored option to something more verbose like snakeCaseifyColumnNames (see comments below)

Activity

  1. added
    RFC
    on Jan 13, 2022
  2. self-assigned this
    on Jan 13, 2022
  3. papb commented on Jan 18, 2022

    @papb
    Member
    • attributeName for the JS side.

    • columnName for the DBMS side.

    👍

    field would continue working for a while but log a deprecation warning.

    Cool, but just to confirm: by "a while" you mean "until the next major version", right? :)

  4. ephys commented on Jan 18, 2022

    @ephys
    MemberAuthor

    Yes, v8, I've updated the RFC :)
    I think this would also be a good place to discuss renaming the underscored option to underscoreColumnNames snakeCaseifyColumnNames or something of the sort. It's verbose but it's not something you have to set often and it would also reduce confusion I think.

  5. papb commented on Jan 19, 2022

    @papb
    Member

    I suggest autoSnakeCaseColumnNames

  6. transferred this issue fromsequelize/meetingson Mar 30, 2022
  7. github-actions commented on Apr 14, 2022

    @github-actions
    Contributor

    This issue has been automatically marked as stale because it has been open for 14 days without activity. It will be closed if no further activity occurs within the next 14 days. If this is still an issue, just leave a comment or remove the "stale" label. 🙂

  8. added
    type: feature
    and removed
    RFC
    on Dec 10, 2022
  9. changed the title [-][RFC] Terminology change in v7[/-] [+]Clarify Column VS Attribute Terminology[/+] on Dec 10, 2022
  10. added theissue type on Mar 9, 2025
  11. removed
    type: feature
    on Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions