Skip to content

sync() with "alter:true" doesn't use field name in model definition  #9515

@yuiagxn

Description

@yuiagxn

What are you doing?

I have a model which is defined like

sequelize.define(‘Test’, {
      test_key: {
          field: ‘testKey’,
          type: DataTypes.BIGINT,
          allowNull: false
      },
})

Then I tried to generate the schema by calling

sequelize.sync({ alter: true, force: true })

I was expecting the column name to be created as "test_key", but it turns out to be "testKey"

And when I tried to call sync() without "alter:true" like

sequelize.sync({ force: true })

Everything works fine.
So there might be a issue for the alter functionality, please help to look into this.

What do you expect to happen?

I expected sync() with "alter:true" use the "field" option to create the column name.

What is actually happening?

But sync() with "alter:true" ignores the "field" option

Dialect: postgres
Dialect version: XXX
Database version: XXX
Sequelize version: 4.37.10
Tested with latest release: 4.37.10

Note : Your issue may be ignored OR closed by maintainers if it's not tested against latest version OR does not follow issue template.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueFor issues. An issue that is a good choice for first-time contributors.type: bugDEPRECATED: replace with the "bug" issue type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions