From cce5f5bd1e39970939efe0cd4a6bdfbf3efba005 Mon Sep 17 00:00:00 2001
From: linuxpoet <linuxpoet@4979c152-3d1c-0410-bac9-87ea11338e46>
Date: Sat, 21 Oct 2006 18:24:38 +0000
Subject: Note to Chrish ... Added users table, added users_conf table which is
 to replace users/username.conf etc... added comments

git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@260 4979c152-3d1c-0410-bac9-87ea11338e46
---
 sql/Pg-upgrade-2.6.18-2.6.19.sql | 48 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 47 insertions(+), 1 deletion(-)

(limited to 'sql/Pg-upgrade-2.6.18-2.6.19.sql')

diff --git a/sql/Pg-upgrade-2.6.18-2.6.19.sql b/sql/Pg-upgrade-2.6.18-2.6.19.sql
index dd8583eb..6613976a 100644
--- a/sql/Pg-upgrade-2.6.18-2.6.19.sql
+++ b/sql/Pg-upgrade-2.6.18-2.6.19.sql
@@ -139,6 +139,52 @@ ALTER TABLE tax ADD COLUMN taxmodule_id int REFERENCES taxmodule DEFAULT 1;
 UPDATE tax SET taxmodule_id = 1;
 ALTER TABLE tax ALTER COLUMN taxmodule_id SET NOT NULL;
 
--- Fixed session table --
+-- Fixed session table and add users table --
+BEGIN;
+LOCK session in EXCLUSIVE MODE;
 ALTER TABLE session ADD CONSTRAINT session_token_check check (length(token::text) = 32);
+ALTER TABLE session ADD column user_id integer not null references users(id);
+LOCK users in EXCLUSIVE MODE;
+CREATE TABLE users (id serial UNIQUE, username varchar(30) PRIMARY KEY);
+COMMENT ON TABLE users 'username is the primary key because we don't want duplicate users';
+LOCK users_conf in EXCLUSIVE MODE;
+CREATE TABLE users_conf(id integer primary key references users(id) deferrable initially deferred,
+                        acs text,
+                        address text,
+                        businessnumber text,
+                        company text,
+                        countrycode text,
+                        currency text,
+                        dateformat text,
+                        dbconnect text,
+                        dbdriver text default 'Pg',
+                        dbhost text default 'localhost',
+                        dbname text,
+                        dboptions text,
+                        dbpasswd text,
+                        dbport text,
+                        dbuser text,
+                        email text,
+                        fax text,
+                        menuwidth text,
+                        name text,
+                        numberformat text,
+                        password varchar(32) check(length(password) = 32),
+                        print text,
+                        printer text,
+                        role text,
+                        sid text,
+                        signature text,
+                        stylesheet text,
+                        tel text,
+                        templates text,
+                        timeout numeric,
+                        vclimit numeric);
+COMMENT ON TABLE users_conf IS 'This is a completely dumb table that is a place holder to get usersconf into the database. Next major release will have a much more sane implementation';
+COMMENT ON COLUMN users_conf.id IS 'Yes primary key with a FOREIGN KEY to users(id) is correct';
+COMMENT ON COLUMN users_conf.password IS 'This means we have to get rid of the current password stuff and move to presumably md5()';
+COMMIT;
+
+
+
 
-- 
cgit v1.2.3

