diff options
-rwxr-xr-x | LedgerSMB/User.pm | 13 | ||||
-rwxr-xr-x | 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, |