brianc / node-sql

SQL generation for node.js
MIT License
1.05k stars 191 forks source link

ON CONFLICT support doesn't take camelCase into account #341

Open artis3n opened 7 years ago

artis3n commented 7 years ago

The recent addition of ON CONFLICT in #335 uses in a test the format:

post.insert({
 +    content: 'test',
 +    userId: 2
 +  }).onConflict({
 +    columns: ['userId'],
 +    update: ['content']
 +  }),

However, if a SQL definition is constructed as:

sql.define({
  name: 'test',
  columns: [
    { name: 'start_time' }
  ],
  snakeToCamel: true,
});

Then, the ON CONFLICT clause will not respect the snakeToCamel setting, and will require update: ['start_time'] instead of update: ['startTime'].

This should be noted somewhere or modified to support the snakeToCamel property.

rohitishere1 commented 7 years ago

Hi, Thanks for reporting, I will share an update soon.

charsleysa commented 6 years ago

@brianc @arikalfus issue is resolved by #342