move loading of certs into CertificationDao

This commit is contained in:
Vincent Breitmoser
2018-06-19 15:11:04 +02:00
parent f3ef530b96
commit 6585e7113d
8 changed files with 120 additions and 146 deletions

View File

@@ -1,13 +1,20 @@
-- TODO implement. this is only here for reference in SQLDelight
CREATE TABLE IF NOT EXISTS certs(
master_key_id INTEGER,
rank INTEGER,
key_id_certifier INTEGER,
type INTEGER,
verified INTEGER,
creation INTEGER,
data BLOB,
master_key_id INTEGER NOT NULL,
rank INTEGER NOT NULL,
key_id_certifier INTEGER NOT NULL,
type INTEGER NOT NULL,
verified INTEGER NOT NULL,
creation INTEGER NOT NULL,
data BLOB NOT NULL,
PRIMARY KEY(master_key_id, rank, key_id_certifier),
FOREIGN KEY(master_key_id) REFERENCES keyrings_public(master_key_id) ON DELETE CASCADE
-- FOREIGN KEY(master_key_id, rank) REFERENCES user_packets(master_key_id, rank) ON DELETE CASCADE
);
);
selectVerifyingCertDetails:
SELECT master_key_id AS masterKeyId, key_id_certifier AS signerMasterKeyId, creation * 1000 AS creation
FROM certs
WHERE verified = 1 AND master_key_id = ? AND rank = ?
ORDER BY creation DESC
LIMIT 1;