Skip to content

Commit b8979da

Browse files
committed
tapdb/sqlc: update mint_anchor_uni_commitments queries to account for new spent_by field
1 parent 000226c commit b8979da

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tapdb/sqlc/queries/assets.sql

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,10 +1040,10 @@ JOIN assets_meta
10401040
ON assets.meta_data_id = assets_meta.meta_id
10411041
WHERE assets.asset_id = $1;
10421042

1043+
-- name: UpsertMintAnchorUniCommitment :one
10431044
-- Upsert a record into the mint_anchor_uni_commitments table.
10441045
-- If a record with the same batch ID and tx output index already exists, update
10451046
-- the existing record. Otherwise, insert a new record.
1046-
-- name: UpsertMintAnchorUniCommitment :one
10471047
WITH target_batch AS (
10481048
-- This CTE is used to fetch the ID of a batch, based on the serialized
10491049
-- internal key associated with the batch.
@@ -1052,26 +1052,27 @@ WITH target_batch AS (
10521052
WHERE keys.raw_key = @batch_key
10531053
)
10541054
INSERT INTO mint_anchor_uni_commitments (
1055-
batch_id, tx_output_index, taproot_internal_key_id, group_key
1055+
batch_id, tx_output_index, taproot_internal_key_id, group_key, spent_by
10561056
)
10571057
VALUES (
1058-
(SELECT batch_id FROM target_batch), @tx_output_index,
1059-
@taproot_internal_key_id, @group_key
1058+
(SELECT batch_id FROM target_batch), @tx_output_index,
1059+
@taproot_internal_key_id, @group_key, sqlc.narg('spent_by')
10601060
)
10611061
ON CONFLICT(batch_id, tx_output_index) DO UPDATE SET
10621062
-- The following fields are updated if a conflict occurs.
10631063
taproot_internal_key_id = EXCLUDED.taproot_internal_key_id,
10641064
group_key = EXCLUDED.group_key
10651065
RETURNING id;
10661066

1067+
-- name: FetchMintAnchorUniCommitment :many
10671068
-- Fetch records from the mint_anchor_uni_commitments table with optional
10681069
-- filtering.
1069-
-- name: FetchMintAnchorUniCommitment :many
10701070
SELECT
10711071
mint_anchor_uni_commitments.id,
10721072
mint_anchor_uni_commitments.batch_id,
10731073
mint_anchor_uni_commitments.tx_output_index,
10741074
mint_anchor_uni_commitments.group_key,
1075+
mint_anchor_uni_commitments.spent_by,
10751076
batch_internal_keys.raw_key AS batch_key,
10761077
mint_anchor_uni_commitments.taproot_internal_key_id,
10771078
sqlc.embed(taproot_internal_keys)

0 commit comments

Comments
 (0)