aboutsummaryrefslogtreecommitdiff
path: root/perl/sql/Wallet-Schema-0.09-0.10-SQLite.sql
diff options
context:
space:
mode:
authorJon Robertson <jonrober@stanford.edu>2014-10-09 22:24:18 -0700
committerJon Robertson <jonrober@stanford.edu>2014-10-09 22:24:18 -0700
commit58186415a0f232cf84ced650ecc1326df66f9c6d (patch)
tree5b34314712a2dd22497dbeab8692a1f3edc03762 /perl/sql/Wallet-Schema-0.09-0.10-SQLite.sql
parent94cfb1c7969515a863d7b0e09f00b6ced5f4fc5c (diff)
Added new column in the Duo table
New column is required to differentiate the Duo table entries now that we have more than one Duo object type. Added the new field and rebuilt schema definitions and upgrade files. Change-Id: Icf538eaded93f4f2820984c087d4850a586a7db1
Diffstat (limited to 'perl/sql/Wallet-Schema-0.09-0.10-SQLite.sql')
-rw-r--r--perl/sql/Wallet-Schema-0.09-0.10-SQLite.sql26
1 files changed, 26 insertions, 0 deletions
diff --git a/perl/sql/Wallet-Schema-0.09-0.10-SQLite.sql b/perl/sql/Wallet-Schema-0.09-0.10-SQLite.sql
new file mode 100644
index 0000000..5feb89f
--- /dev/null
+++ b/perl/sql/Wallet-Schema-0.09-0.10-SQLite.sql
@@ -0,0 +1,26 @@
+-- Convert schema 'sql/Wallet-Schema-0.09-SQLite.sql' to 'sql/Wallet-Schema-0.10-SQLite.sql':;
+
+BEGIN;
+
+-- Back up Duo data to a temp table. SQLite has limited ALTER TABLE support,
+-- so we need to do this to alter the keys on the table.
+CREATE TEMPORARY TABLE duo_backup (
+ du_name varchar(255) NOT NULL,
+ du_key varchar(255) NOT NULL,
+ PRIMARY KEY (du_name)
+);
+INSERT INTO duo_backup SELECT du_name,du_key FROM duo;
+DROP TABLE duo;
+
+-- Create the new Duo table and move the old data into it.
+CREATE TABLE duo (
+ du_name varchar(255) NOT NULL,
+ du_type varchar(16) NOT NULL,
+ du_key varchar(255) NOT NULL,
+ PRIMARY KEY (du_name, du_type),
+ FOREIGN KEY (du_type, du_name) REFERENCES objects(ob_type, ob_name)
+);
+INSERT INTO duo SELECT du_name,du_key,'duo' FROM duo_backup;
+DROP TABLE duo_backup;
+
+COMMIT;