From cc201091119a448036c0710d121602fd72b83628 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Mon, 18 Sep 2006 05:40:51 +0000 Subject: fixed broken db version. Also fixed bug of trying to add all relations to template1. git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@110 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/User.pm | 13 ++++++++----- sql/Pg-tables.sql | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm index d0ccfc61..e0f2bc6b 100755 --- a/LedgerSMB/User.pm +++ b/LedgerSMB/User.pm @@ -306,10 +306,18 @@ sub dbcreate { $form->{sid} = $form->{dbdefault}; &dbconnect_vars($form, $form->{dbdefault}); + # The below line connects to Template1 or another template file in order + # to create the db. One must disconnect and reconnect later. my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; my $query = qq|$dbcreate{$form->{dbdriver}}|; $dbh->do($query) || $form->dberror($query); + $dbh->disconnect; + #Reassign for the work below + + &dbconnect_vars($form, $form->{db}); + + my $dbh = DBI->connect($form->{dbconnect}, $form->{dbuser}, $form->{dbpasswd}) or $form->dberror; # JD: We need to check for plpgsql, if it isn't there create it, if we can't error # Good chance I will have to do this twice as I get used to the way the code is # structured @@ -318,11 +326,6 @@ sub dbcreate { my $query = qq|$langcreate{$form->{dbdriver}}|; $dbh->do($query) || $form->dberror($query); - #Reassign for the work below - - &dbconnect_vars($form, $form->{db}); - - # create the tables my $dbdriver = ($form->{dbdriver} =~ /Pg/) ? 'Pg' : $form->{dbdriver}; diff --git a/sql/Pg-tables.sql b/sql/Pg-tables.sql index 264585ca..7c1676bf 100755 --- a/sql/Pg-tables.sql +++ b/sql/Pg-tables.sql @@ -71,7 +71,7 @@ CREATE TABLE defaults ( glnumber text, projectnumber text ); -INSERT INTO defaults (version) VALUES ('2.6.17'); +INSERT INTO defaults (version) VALUES ('2.6.18'); -- CREATE TABLE acc_trans ( trans_id int, -- cgit v1.2.3