summaryrefslogtreecommitdiff
path: root/sql/legacy
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-17 03:25:39 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-11-17 03:25:39 +0000
commit459b8c504ca964effbbe56ab459dd5768c7d284f (patch)
tree9b2d7ee9cfe3ef507b3e74d2f703a534dedd0f13 /sql/legacy
parent6ca865eddba4b77e94c33e7441d28915f8a70c65 (diff)
Fixing braindead issues in upgrade script
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@647 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'sql/legacy')
-rw-r--r--sql/legacy/Pg-upgrade-2.6.17-2.6.18.sql2
-rw-r--r--sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql19
2 files changed, 9 insertions, 12 deletions
diff --git a/sql/legacy/Pg-upgrade-2.6.17-2.6.18.sql b/sql/legacy/Pg-upgrade-2.6.17-2.6.18.sql
index b73f4c35..7d27c2a4 100644
--- a/sql/legacy/Pg-upgrade-2.6.17-2.6.18.sql
+++ b/sql/legacy/Pg-upgrade-2.6.17-2.6.18.sql
@@ -1,3 +1,4 @@
+BEGIN;
ALTER TABLE chart ADD PRIMARY KEY (id);
-- linuxpoet:
-- adding primary key to acc_trans
@@ -285,3 +286,4 @@ END;
-- end function
UPDATE defaults SET version = '2.6.18';
+COMMIT;
diff --git a/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql b/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql
index 9594f9a0..a5628186 100644
--- a/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql
+++ b/sql/legacy/Pg-upgrade-2.6.18-2.6.19.sql
@@ -152,18 +152,8 @@ UPDATE tax SET taxmodule_id = 1;
ALTER TABLE tax ALTER COLUMN taxmodule_id SET NOT NULL;
-- 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);
-
--- comment this out when user db is working:
-ALTER TABLE session ALTER COLUMN user_id DROP NOT NULL;
-
-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,
@@ -199,13 +189,18 @@ CREATE TABLE users_conf(id integer primary key references users(id) deferrable i
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;
+
+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);
+
+-- comment this out when user db is working:
+ALTER TABLE session ALTER COLUMN user_id DROP NOT NULL;
-- Admin user --
BEGIN;
INSERT INTO users(username) VALUES ('admin');
INSERT INTO users_conf(id,password) VALUES (currval('users_id_seq'),NULL);
-COMMIT;
-- Functions