luckyframework / luckyframework/avram

Checking `new_record?` when using upsert

Open
#874 1 comment 0 reactions 0 assignees View on GitHub
needs investigation
Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

I believe that `new_record?` will always be true when using `upsert` because `new_record?` basically does `id.value.nil?`. The `id.value` is only filled in when you pass in `@record` which doesn't happen on upserts.

I'll have to look more in to this, but we had an issue using `new_record?` with the upsert, and it seemed that it was always returning true no matter what.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how new_record? determines its result during an upsert, focusing on the id value and the @record path mentioned in the report. Reproduce the behavior and establish the expected result for both new and existing records; done means the behavior is corrected or clearly confirmed with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal, postgresql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.