Skip to content

docs: split id-update into upsert vs delete-then-insert strategies#222

Merged
Fivell merged 1 commit into
masterfrom
docs/update-by-id-strategies
Jun 15, 2026
Merged

docs: split id-update into upsert vs delete-then-insert strategies#222
Fivell merged 1 commit into
masterfrom
docs/update-by-id-strategies

Conversation

@Fivell

@Fivell Fivell commented Jun 15, 2026

Copy link
Copy Markdown
Member

Follow-up to #220.

The "Update existing records by id" README section led with the delete_all recipe as the primary way, which reads as if it is outdated next to the native :on_duplicate_key_update upsert added in #220. It is not — it is a different tool. This restructures the section so the reader can pick the right one:

  • Native upsert (recommended where supported):on_duplicate_key_update, single statement, updates only the listed columns. Adapter note trimmed to the two option shapes (PG/SQLite vs MySQL).
  • Delete-then-insert (any database) — the delete_all recipe, kept and honestly framed: works on any adapter, lets model validations run, but is a full-row replace plus an extra query.

Docs only — no code changes.

The delete_all recipe isn't obsolete — it's a different tool (DB-agnostic,
validation-friendly, full-row replace). Present both approaches with their
trade-offs and lead with the native :on_duplicate_key_update upsert, trimming
the adapter notes to the PG/SQLite vs MySQL option shapes.
@Fivell Fivell merged commit 1e282be into master Jun 15, 2026
38 checks passed
@Fivell Fivell mentioned this pull request Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant