From: Sam Hartman Date: Thu, 12 Mar 2015 16:33:50 +0000 (-0400) Subject: Schema updates; exclude expired keys from view X-Git-Tag: 1.5~10 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=trust_router.git;a=commitdiff_plain;h=f5ba22634b90bae7df993a22c135b4dcb461f716 Schema updates; exclude expired keys from view --- diff --git a/schema.sql b/schema.sql index f5acc4a..006c06b 100644 --- a/schema.sql +++ b/schema.sql @@ -1,7 +1,7 @@ -create table if not exists psk_keys (keyid text primary key, key blob, client_dh_pub raw(20), key expiration timestamp); +create table if not exists psk_keys (keyid text primary key, key blob, client_dh_pub raw(20), key_expiration timestamp); create table if not exists authorizations( client_dh_pub raw(20), coi string, acceptor_realm string, hostname string, apc string); create index if not exists authorizations_dhpub on authorizations( client_dh_pub); -CREATE VIEW if not exists authorizations_keys as select keyid, authorizations.* from psk_keys join authorizations on psk_keys.client_dh_pub = authorizations.client_dh_pub; +CREATE VIEW if not exists authorizations_keys as select keyid, authorizations.* from psk_keys join authorizations on psk_keys.client_dh_pub = authorizations.client_dh_pub and datetime(key_expiration) < datetime('now'); .quit