From 5b29ea6472dd5ac71771ce9dc61c1193f81267a5 Mon Sep 17 00:00:00 2001
From: Rob Austein <sra@hactrn.net>
Date: Tue, 28 Jun 2016 16:11:44 -0400
Subject: Move hal_pkey_* columns from the object table into
 {session,token}_object tables to preserve the mapping from pkcs11 token
 objects to libhal pkey objects.

---
 schema.sql | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'schema.sql')

diff --git a/schema.sql b/schema.sql
index bc984ab..9de8ce2 100644
--- a/schema.sql
+++ b/schema.sql
@@ -63,8 +63,6 @@ CREATE TEMPORARY TABLE IF NOT EXISTS object (
         object_id               INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
         object_handle           INTEGER NOT NULL UNIQUE
                                 CHECK (object_handle > 0 AND object_handle <= 0xFFFFFFFF),
-        hal_pkey_type           INTEGER,
-        hal_pkey_ski            BLOB,
         session_id              INTEGER REFERENCES session
                                 ON DELETE CASCADE ON UPDATE CASCADE
                                 DEFERRABLE INITIALLY DEFERRED,
@@ -79,6 +77,8 @@ CREATE TEMPORARY TABLE IF NOT EXISTS object (
 
 CREATE TEMPORARY TABLE IF NOT EXISTS session_object (
         session_object_id       INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+        hal_pkey_type           INTEGER,
+        hal_pkey_ski            BLOB,
         object_id               INTEGER NOT NULL UNIQUE
                                 REFERENCES object
                                 ON DELETE CASCADE ON UPDATE CASCADE
@@ -94,7 +94,9 @@ CREATE TEMPORARY TABLE IF NOT EXISTS session_attribute (
 );
 
 CREATE TABLE IF NOT EXISTS token_object (
-        token_object_id         INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL
+        token_object_id         INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
+        hal_pkey_type           INTEGER,
+        hal_pkey_ski            BLOB
 );
 
 CREATE TABLE IF NOT EXISTS token_attribute (
-- 
cgit v1.2.3

