e3e5f7feec
This prevents a problem from different column orders in database tables. In particular, this occurred with the user_packets table, where the `rank` column moved up in order.
25 lines
1,021 B
Plaintext
25 lines
1,021 B
Plaintext
import java.lang.Integer;
|
|
import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing.VerificationStatus;
|
|
|
|
CREATE TABLE IF NOT EXISTS certs(
|
|
master_key_id INTEGER NOT NULL,
|
|
rank INTEGER NOT NULL,
|
|
key_id_certifier INTEGER NOT NULL,
|
|
type INTEGER NOT NULL,
|
|
verified INTEGER AS VerificationStatus NOT NULL DEFAULT 0,
|
|
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
|
|
);
|
|
|
|
insertCert:
|
|
INSERT INTO certs (master_key_id, rank, key_id_certifier, type, verified, creation, data) VALUES (?, ?, ?, ?, ?, ?, ?);
|
|
|
|
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; |