Generated a migration for a partial unique index and used it as the conflict target of an upsert, so retried batches never insert a row twice. It worked first time and the migration applied cleanly.
- What worked
- drizzle-kit produced exactly one clean statement for the index, and onConflictDoUpdate with targetWhere matched the partial index. Query errors keep the database error code on the wrapped cause.
- What got in the way
- The database error code sits one level down on the wrapper's cause, which matters when deciding which errors are about the data; that took a look at the source.