clockworklabs / clockworklabs/SpacetimeDB

Prevent Auto_Inc PK columns collisions after inserting PK manually ie because of migrations

Open
#5,235 0 comments 0 reactions 0 assignees View on GitHub

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

After you manually insert anything in a auto inc pk column you boobytrapped your table waiting for auto pk insertions to collide nastily. Lots of users have had to roll their own collision prevention or even create their own PK tables. As if you ever have pk autoinc columns and manual data migration you will run into this problem.

Auto Inc PKs should skip the value and attempt the next one or start at the max value or smth. GL!

Requested by @Pepn via the SpacetimeDB site.

Contributor guide

No contributing guide indexed for this repository

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

The issue names no files, tests, or entry points, so first locate the auto-increment primary-key implementation and its existing tests. Clarify the intended behavior for manually inserted values, then verify that later automatic insertions cannot collide and that the behavior is covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.