diff --git a/lib/go/camli/mysqlindexer/dbschema.go b/lib/go/camli/mysqlindexer/dbschema.go index e54df81e9..5cb6f9163 100644 --- a/lib/go/camli/mysqlindexer/dbschema.go +++ b/lib/go/camli/mysqlindexer/dbschema.go @@ -18,7 +18,7 @@ package mysqlindexer import () -const requiredSchemaVersion = 11 +const requiredSchemaVersion = 12 func SchemaVersion() int { return requiredSchemaVersion @@ -87,5 +87,13 @@ INDEX (permanode))`, `CREATE TABLE meta ( metakey VARCHAR(255) NOT NULL PRIMARY KEY, value VARCHAR(255) NOT NULL)`, + + // Map from blobref (of ASCII armored public key) to keyid + `CREATE TABLE signerkeyid ( +blobref VARCHAR(128) NOT NULL, +PRIMARY KEY (blobref), +keyid VARCHAR(128) NOT NULL, +INDEX (keyid) +)`, } } diff --git a/lib/go/camli/mysqlindexer/receive.go b/lib/go/camli/mysqlindexer/receive.go index ddc412b1e..9c933a8de 100644 --- a/lib/go/camli/mysqlindexer/receive.go +++ b/lib/go/camli/mysqlindexer/receive.go @@ -196,6 +196,11 @@ func (mi *Indexer) populateClaim(client *mysql.Client, blobRef *blobref.BlobRef, if vr.Verify() { verifiedKeyId = vr.SignerKeyId log.Printf("mysqlindex: verified claim %s from %s", blobRef, verifiedKeyId) + + if err = execSQL(client, "INSERT IGNORE INTO signerkeyid (blobref, keyid) "+ + "VALUES (?, ?)", vr.CamliSigner.String(), verifiedKeyId); err != nil { + return + } } else { log.Printf("mysqlindex: verification failure on claim %s: %v", blobRef, vr.Err) }