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

Declaring references and associations such as belongsTo duplicates the column names #9244

Closed
leolorenzoluis opened this issue Mar 27, 2018 · 2 comments

Comments

@leolorenzoluis
Copy link

What are you doing?

If a model definition has a reference declare such as: (The rest of the model definition are omitted)

roleId: { 
           field: 'ROLE_ID'
           references: {
               model: 'ROLE',
               key: 'ROLE_ID',
          }

with references declared and another declaration such as user.belongsTo(Role, { foreignKey: 'ROLE_ID' }); and MS SQL Triggers are on for the Users table

and we simply call User.create(newUser);.

What do you expect to happen?

I want to either raise an exception that I'm doing something horribly wrong or really why is there a duplicate in the first place?

What is actually happening?

The generated temporary table duplicates the column name ROLE_ID.

Dialect: mysql
Dialect version: latest
Database version: MS SQL Server 2012
Sequelize version: 4.33.4
Tested with latest release: Yes (If yes, specify that version)

@sushantdhiman
Copy link
Contributor

Please use Github Issue Tracker only for reporting bugs, requesting new features or discussions. Ask questions on Stackoverflow sequelize.js tag or Slack. While I would like to help answer any questions but it still take too much time.

If you are reporting a bug please isolate it as SSCCE, present it nicely and follow issue template. This will help maintainers and contributors understand your issue quickly.

If you are requesting a feature spend some time to properly present your use case with some examples, current and expected outcome.

( What is SSCCE ? You can find template for Sequelize here )

A few good example of SSCCE

  1. ResourceRequest timed out - connection not reestablished after db restarted #8014 (comment)
  2. removeAttribute('id') results in undefined: null data value #7318 (comment)
  3. toJSON converting booleans to "t" (true) or "f" (false) #8749 (comment)

@leolorenzoluis
Copy link
Author

Lol. I assume you didn't fully read my expectations. It is a bug because it's generating multiple column names. O well.

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