Skip to content

Commit

Permalink
on replace block
Browse files Browse the repository at this point in the history
  • Loading branch information
boudra committed Apr 24, 2024
1 parent 751c216 commit f405786
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/cache/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,13 @@ export function createPostgresCache(args: {
await client.query(
`INSERT INTO ${tableName(
"blocks"
)} (chainId, blockNumber, blockHash, timestamp) VALUES ($1, $2, $3, $4)`,
)} (chainId, blockNumber, blockHash, timestamp) VALUES ($1, $2, $3, $4)
ON CONFLICT (chainId, blockhash) DO UPDATE SET
blockHash = EXCLUDED.blockHash,
timestamp = EXCLUDED.timestamp,
blockNumber = EXCLUDED.blocknumber,
chainId = EXCLUDED.chainId
`,
[
args.chainId,
args.blockNumber.toString(),
Expand Down

0 comments on commit f405786

Please sign in to comment.