Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

add breaking test for upsert #10

Closed
wants to merge 2 commits into from
Closed

add breaking test for upsert #10

wants to merge 2 commits into from

Conversation

0ff
Copy link

@0ff 0ff commented Jun 5, 2015

There is a quirk in this mixin: if you upsert a model (i.e. you just know the id and properties, but you don't want to find it first) the createdAt-Timestamp is updated, too. This must not happen, of course.
I fear it's related to the lb-ds-juggler's implementation of default values.

Can you think of a solution besides querying for the model everytime?

0ff added 2 commits June 5, 2015 12:26
There is a quirk in this mixin: if you `upsert` a model (i.e. you just know the id and properties, but you don't want to `find` it first) the createdAt-Timestamp is updated, too. This must not happen, of course.
I fear it's related to the lb-ds-juggler's implementation of default values.

Can you think of a solution besides querying for the model everytime?
@clarkbw
Copy link
Owner

clarkbw commented Jun 5, 2015

Good catch! I'm looking into this in #11
Seems like the README should be updated to show this. I can get it fixed in juggler and bump the required release version; leaving a note in the README.

@clarkbw
Copy link
Owner

clarkbw commented Jul 14, 2015

@0ff the fix landed in loopbackio/loopback-datasource-juggler@01af886 I'll update the package.json file to reflect this and I'll try to pull in your tests as well.

@0ff
Copy link
Author

0ff commented Jul 18, 2015

Awesome, thank you!

@clarkbw clarkbw closed this in 93e8df0 Jul 22, 2015
@mrshll
Copy link

mrshll commented Nov 14, 2015

For anyone coming to here because of the runtime warning, you have to make sure your model.json has the validateUpsert option set to false:

{
  "name": "Message",
  "plural": "messages",
  "options": {
    "validateUpsert": false
  }
}

vgeorge added a commit to aparabolica/pnete-monitor that referenced this pull request Nov 15, 2015
@cvrabie
Copy link

cvrabie commented Jan 24, 2016

Disabling validation for upsert seems like a big disadvantage. Are there any plans to address this in the future?

@ShaharHD
Copy link

I've branched off and revised a better solution IMHO.

I'm creating a pull request.

ShaharHD added a commit to CargoMatrix/loopback-ds-timestamp-mixin that referenced this pull request Feb 11, 2016
clarkbw pushed a commit that referenced this pull request Mar 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants