clockworklabs / clockworklabs/SpacetimeDB
Feature request: `insert_or_update` ("upsert")
Open
Nobody has claimed this yet.
feature-request
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
Something like this:
// Pseudocode
func upsert(ctx, primary_key_value, value):
if ctx.primary_key_column.try_find(primary_key_value):
// Row with a matching primary key column exists
ctx.primary_key_column.delete(primary_key_value)
ctx.primary_key_column.insert(primary_key_value, value)
In order to upsert on a column it needs to have a unique constraint on it.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the table and unique-constraint handling behind insert, delete, and try_find; the issue names no files or tests. Trace how a primary-key lookup and replacement currently work, then determine where upsert and its unique-constraint requirement belong. Done means the requested insert_or_update behavior is defined and covered for matching and non-matching rows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100