mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 22:22:36 +02:00
Merge pull request #10010 from ellemouton/sqlGraphUpdates
graph/db: various misc updates
This commit is contained in:
@ -65,21 +65,21 @@ SELECT EXISTS (
|
||||
AND n.pub_key = $1
|
||||
);
|
||||
|
||||
-- name: GetUnconnectedNodes :many
|
||||
SELECT n.id, n.pub_key
|
||||
FROM nodes n
|
||||
-- Select all nodes that do not have any channels.
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM channels c
|
||||
WHERE c.node_id_1 = n.id OR c.node_id_2 = n.id
|
||||
)
|
||||
-- Ignore any of our source nodes.
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM source_nodes sn
|
||||
WHERE sn.node_id = n.id
|
||||
);
|
||||
-- name: DeleteUnconnectedNodes :many
|
||||
DELETE FROM nodes
|
||||
WHERE
|
||||
-- Ignore any of our source nodes.
|
||||
NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM source_nodes sn
|
||||
WHERE sn.node_id = nodes.id
|
||||
)
|
||||
-- Select all nodes that do not have any channels.
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM channels c
|
||||
WHERE c.node_id_1 = nodes.id OR c.node_id_2 = nodes.id
|
||||
) RETURNING pub_key;
|
||||
|
||||
-- name: DeleteNodeByPubKey :execresult
|
||||
DELETE FROM nodes
|
||||
|
Reference in New Issue
Block a user