PhilWaldmann / openrecord

Make ORMs great again!
https://openrecord.js.org
MIT License
486 stars 38 forks source link

validates uniqueness of fails with UUID pk #48

Closed SampsonCrowley closed 7 years ago

SampsonCrowley commented 7 years ago
{ [SQLError: error: select count(*) as "count" from "accounts" where "accounts"."email" = $1 and "accounts"."id" != $2 - invalid input syntax for uuid: "1"]
  message:
   { error: invalid input syntax for uuid: "1"
       at Connection.parseE (/home/samps/sites/personal/dus/office.downundersports.com/node/node_modules/pg/lib/connection.js:567:11)
       at Connection.parseMessage (/home/samps/sites/personal/dus/office.downundersports.com/node/node_modules/pg/lib/connection.js:391:17)
SampsonCrowley commented 7 years ago

I don't know where that "1" would be coming from. this is on create of a brand new record

SampsonCrowley commented 7 years ago

the id is being set on new

newAccount = Account.new({email: account.email.toLowerCase(), password: account.password})
console.log(newAccount); #=> `<Account {id:"1" email:"myemail@email.email" password:"password" athlete_id:null created_at:null updated_at:null}>`
SampsonCrowley commented 7 years ago

found it. I'll put together a PR

SampsonCrowley commented 7 years ago

fixed in https://github.com/PhilWaldmann/openrecord/pull/49

SampsonCrowley commented 7 years ago

You can close this once everything's merged in

PhilWaldmann commented 7 years ago

Perfekt! Thx

I'll release the new version tomorrow