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

Query Builder merge don't translate names #2177

Closed
Nisgrak opened this issue Sep 6, 2021 · 0 comments
Closed

Query Builder merge don't translate names #2177

Nisgrak opened this issue Sep 6, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Nisgrak
Copy link

Nisgrak commented Sep 6, 2021

Describe the bug
Using query builder with onConflict and merge it doesn't use the naming convention to translate the props

Stack trace

insert into `issues_clients` (`added_time`, `anomaly_id`, `id_issues`, `id_issues_clients`, `id`, `provcode`, `solved_time`, `status`, `ticket_pending`, 
`updateAt`) values (1628665711, 'XXX', 45129, NULL, 'XXX', 'XXX', 0, 0, 0, '2021-09-06 12:10:58.086') on duplicate key update `status` = VALUES(status),`solvedTime` = 0 - (conn=512988, no: 1054, SQLState: 42S22) Unknown column 'solvedTime' in 'field list'
sql: insert into `issues_clients` (`added_time`, `anomaly_id`, `id_issues`, `id_issues_clients`, `id`, `provcode`, `solved_time`, `status`, `ticket_pending`, 
`updateAt`) values (1628665711, 'XXX', 45129, NULL, 'XXX', 'XXX', 0, 0, 0, '2021-09-06 12:10:58.086') on duplicate key update `status` = VALUES(status),`solvedTime` = 0  - parameters:[]

To Reproduce
Steps to reproduce the behavior:

  1. Create querybuilder insert
  2. Use insert, onConflict and merge
  3. Pass an object to merge with fields to update on duplicate

Expected behavior
The on conflict updates of sql need to have solved_time not solvedTime

Additional context
The entity has solvedTime prop, and in the db has solved_time, work with other methods.

I'm using this object in merge

{
    "solvedTime": 0
}

Versions

Dependency Version
node 14.17.3
typescript 4.3.5
mikro-orm 4.5.7
@mikro-orm/mariadb 4.5.7
@B4nan B4nan added the bug Something isn't working label Sep 12, 2021
@B4nan B4nan closed this as completed in 5aead23 Sep 12, 2021
Langstra pushed a commit to RiskChallenger/mikro-orm that referenced this issue Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants