herrBez / Nduja

Nduja is a software that de-anonymize crypto-currencies' addresses
BSD 3-Clause "New" or "Revised" License
4 stars 4 forks source link

Eliminate orphan data #70

Closed mzanella closed 6 years ago

mzanella commented 6 years ago
herrBez commented 6 years ago

What does it mean Orphan Wallet (!= -1)?

herrBez commented 6 years ago

Delete the accounts that do not have an AccountWallet anymore and consequently remove also the information related to them.

DROP TABLE IF EXISTS _Variables; 
CREATE TEMP TABLE _Variables(account_id INTEGER, info_id INTEGER);

INSERT INTO _Variables ( account_id, info_id ) 
SELECT _id, info 
FROM Account 
WHERE _id not in 
(SELECT a._id
FROM Account as a, AccountWallet as aw 
WHERE aw.Account = a._id);

DELETE FROM Account WHERE _id in (SELECT account_id FROM _Variables);

DELETE FROM Information WHERE _id in (SELECT info_id FROM _Variables);

DROP TABLE _Variables;
herrBez commented 6 years ago

delete orphan information


DROP TABLE IF EXISTS _Variables; 
CREATE TEMP TABLE _Variables(info_id INTEGER);

INSERT INTO _Variables ( info_id ) 
SELECT _id 
FROM Information 
WHERE _id not in 
(SELECT info
FROM Account as a);

DELETE FROM Information WHERE _id in (SELECT info_id FROM _Variables);

DROP TABLE _Variables;