-- This schema contains only the commands necessary to upgrade 
-- a SQL database created by the phpwiki 1.3.11p1 debian package to the
-- schema used by the 1.3.12p2 release of PHPwiki.
-- 
-- Author:  Matt Brown <debian@mattb.net.nz>
-- Date: 18 Mar 2006

-- Debian's Current sqlite lacks ALTER TABLE support, so use the following hack
BEGIN TRANSACTION;
CREATE TEMPORARY TABLE pref_backup(userid, prefs);
INSERT INTO pref_backup SELECT * FROM pref;
DROP TABLE pref;
CREATE TABLE pref (
        userid  CHAR(48) NOT NULL PRIMARY KEY,
        prefs   TEXT NULL DEFAULT '',
        passwd  CHAR(48) DEFAULT '',
        groupname CHAR(48) DEFAULT 'users'
);
CREATE INDEX pref_userid ON pref (userid);
INSERT INTO pref (userid, prefs) SELECT * FROM pref_backup;
DROP TABLE pref_backup;
COMMIT;
