Skip to content

'underscored: true' is working but return to two value when responsing to request #11306

Closed

Description

@BaeJi77

What are you doing?

This is result when requesing node js express. 
{
       ...
        "student_id": 1,
        "trainer_id": 1,
        "createdAt": "2019-08-10T06:47:08.000Z",
        "updatedAt": "2019-08-10T06:47:08.000Z",
        "trainerId": 1,
        "studentId": 1,
     ...
}

To Reproduce
Steps to reproduce the behavior:

  1. I set-up using 'sequelize-define.json'
{
  "development": {
    "username": "root",
    "password": "0000",
    "database": "...",
    "host": "127.0.0.1",
    "dialect": "mysql",
    "timezone": "+09:00",
    "charset": "utf8",
    "collate": "utf8_general_ci",
    "define": {
      "timestamps": true,
      "underscored": true,
      "underscoredAll": true
    }
  }
}

And, I make snack case column. Show real example my code.
'define code('notification.js')'

return sequelize.define('notification', {
        to_whom: DataTypes.INTEGER,
        contents: DataTypes.STRING,
        type: DataTypes.INTEGER,
        schedule_id: DataTypes.INTEGER,
        origin_date: DataTypes.DATE,
        request_date: DataTypes.DATE,
        student_id: DataTypes.INTEGER,
        trainer_id: DataTypes.INTEGER
    })

'Make join ('index.js')'

db.Trainer.hasMany(db.Notification, {foreignKey: 'trainer_id'});
db.Notification.belongsTo(db.Trainer);

db.Student.hasMany(db.Notification, {foreignKey: 'student_id'});
db.Notification.belongsTo(db.Student);
  1. Database is set snack case.
  2. But always return 2 valuse. camelcase + snack case.

What do you expect to happen?

I want only snack case value when request api.

What is actually happening?

But return two value. when requesting some api.

Environment

Dialect:

  • [v] mysql
    Dialect library version:
    Database version: Server version: 8.0.16 Homebrew
    Sequelize version: [email protected]
    Node Version: v12.5
    OS: OSX Mojave (10.14.5)

Activity

  1. changed the title [-]'underscored'[/-] [+]'underscored: true' is working but always to value when responsing to request[/+] on Aug 10, 2019
  2. changed the title [-]'underscored: true' is working but always to value when responsing to request[/-] [+]'underscored: true' is working but return to two value when responsing to request[/+] on Aug 10, 2019
  3. papb commented on Aug 10, 2019

    @papb
    Member

    Closing in favor of #11225

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions