Inserts a row, or updates the conflicting columns when a unique/primary key already exists (INSERT ... ON CONFLICT ... DO UPDATE).
INSERT ... ON CONFLICT ... DO UPDATE
Type of returned rows when RETURNING is used
RETURNING
Primary key used for shard routing
Target table name
Column to value map for the row
Column(s) forming the conflict target
Upsert modifiers (update subset, returning)
update
returning
The write result
1.2.4
await upsert('settings:theme', 'settings', { key: 'theme', value: 'dark' }, 'key'); Copy
await upsert('settings:theme', 'settings', { key: 'theme', value: 'dark' }, 'key');
Inserts a row, or updates the conflicting columns when a unique/primary key already exists (
INSERT ... ON CONFLICT ... DO UPDATE).