summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rwxr-xr-xsql/Pg-tables.sql42
-rw-r--r--sql/Pg-upgrade-2.6.18-2.6.19.sql48
2 files changed, 88 insertions, 2 deletions
diff --git a/sql/Pg-tables.sql b/sql/Pg-tables.sql
index 78b7835f..b56a4d5c 100755
--- a/sql/Pg-tables.sql
+++ b/sql/Pg-tables.sql
@@ -568,7 +568,8 @@ CREATE TABLE session(
session_id serial PRIMARY KEY,
sl_login VARCHAR(50),
token VARCHAR(32) CHECK(length(token) = 32),
-last_used TIMESTAMP default now()
+last_used TIMESTAMP default now(),
+users_id integer not null references users(id),
);
@@ -710,3 +711,42 @@ INSERT INTO taxmodule (
) VALUES (
1, 'Simple'
);
+
+-- USERS stuff --
+CREATE TABLE users (id serial UNIQUE, username varchar(30) primary key);
+COMMENT ON TABLE users IS 'username is the actual primary key here because we don't want duplicate users';
+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()';
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;
+
+
+