summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-09-18 05:40:51 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-09-18 05:40:51 +0000
commitcc201091119a448036c0710d121602fd72b83628 (patch)
treec1a7000feea86f4cbd92d8b73258f8e04e0647b7
parent6b4db289cc6af2b4588102bd02800d342a17ca52 (diff)
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
-rwxr-xr-xLedgerSMB/User.pm13
-rwxr-xr-xsql/Pg-tables.sql2
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,