Skip to content

Portable upsert on SQLite and MySQL, plus an excluded helper #81

Open

Description

@artile

Signal

onConflictDoUpdate / onConflictDoNothing exist for Postgres. We want them on all dialects:

  • SQLite / D1: INSERT … ON CONFLICT(cols) DO UPDATE SET … = excluded.col.
  • MySQL: INSERT … ON DUPLICATE KEY UPDATE col = VALUES(col) (or the row alias on MySQL 8.0.19+). Refuse an explicit conflict target, because MySQL uses all unique keys.
  • setExcluded(cols): "set all from excluded" (gap review P1).

Why (MyRemotely)

  • 70 upsert and 10 skipDuplicates call sites. Sync from Rentvine, TTLock and Twilio is upsert-heavy.

Part of #52: the CAFE-stack roadmap signal from MyRemotely. This shows the direction we want, and it is not a demand. We can send a PR if you accept the idea.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions