diff options
author | Russ Allbery <eagle@eyrie.org> | 2014-12-08 18:33:09 -0800 |
---|---|---|
committer | Russ Allbery <eagle@eyrie.org> | 2014-12-08 18:33:09 -0800 |
commit | 535ab35781b30805962201874ffff16492ca265d (patch) | |
tree | 433a3446b17227a87f29e064aa710a88f7f8a4ac /perl/sql/Wallet-Schema-0.09-0.10-SQLite.sql | |
parent | d5968989923768688b7bd2e4279a9db43a2b93df (diff) | |
parent | 49f5b0d38e96d13b6cfb329b21599f9d6ff853d6 (diff) |
Merge pull request #1 from jonrober/master
Duo and rename updates
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.sql | 26 |
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; |