luckyframework / luckyframework/avram

`Query#update` doesn't allow *not* updating the `updated_at` field

Open
#1,155 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Crystal
Stars
183
Forks
67
PR merge metrics
No merged PRs in 30d

Description

Right now, batch `Query#update`, always changes `updated_at`.

I *totally understand* the reason why it was added (#1087 and #1091), but I also think it would be useful to have an option to opt-in / out.

Since at first I thought doing `column: IGNORE` would do something like this (wrong), I was thinking of a solution such as

```crystal
Query.update(column: value, updated_at: UNCHANGED) # so you can specifically opt-out of auto updating
# or something like...
Query.update_only(column: value) # only available on tables that have have the timestamps
```
That would be useful for system-wide tasks / admin stuff and batch updating models with a lot of columns.
I wonder what anyone else thinks of this? Let me know :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Query#update entry point and the timestamp behavior described in issues #1087 and #1091. The issue proposes alternative APIs but does not select one; clarify the intended opt-out behavior, then define tests showing when updated_at changes or remains unchanged. Done means an agreed API and coverage for both update modes.

Written by the indexing model from the issue text.

Assessment

Tech stack
crystal, postgresql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.