[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] migration fixes for SL2.8 -> SMBLedger 1.3
- Subject: [PATCH] migration fixes for SL2.8 -> SMBLedger 1.3
- From: Ward Vandewege <..hidden..>
- Date: Mon, 23 Sep 2013 22:42:20 -0400
I upgraded a SL2.8 installation to SMBLedger 1.3.34 this evening, and that
required a few patches (see attached).
The changes to Database.pm are straightforward.
The changes to sl2.8-1.3.sql consist of 2 hunks.
The first hunk hardcodes the default_country, default_ar and default_ap
values. They were not being set correctly on my system; I didn't figure out
why. This hunk should probably not be merged as is.
The second hunk is a fix for the 'recurring' table, which now contains one
more field in SMBLedger than it does in SL2.8 (or at least, SL version 2.8.10
which is what I started from).
Thanks,
Ward.
--
Ward Vandewege <..hidden..>
We're hiring: get paid to write free software
http://www.clinicalfuture.com/engineer
--- Database.pm 2013-09-23 22:27:59.694425842 -0400
+++ Database.pm 2013-09-23 21:48:12.401197341 -0400
@@ -359,8 +359,8 @@
$sth->execute('version');
if (my $ref = $sth->fetchrow_hashref('NAME_lc')){
$retval->{appname} = 'sql-ledger';
- $retval->{full_version} = $ref->{fldname};
- $retval->{version} = $ref->{fldname};
+ $retval->{full_version} = $ref->{fldvalue};
+ $retval->{version} = $ref->{fldvalue};
$retval->{version} =~ s/(\d+\.\d+).*/$1/g;
} else {
$retval->{appname} = 'unknown';
@@ -623,7 +623,6 @@
users);
my $retval = {};
my $qtemp = 'SELECT count(*) FROM TABLE';
- my $dbh =
my $dbh = DBI->connect(
"dbi:Pg:dbname=$self->{company_name}",
$self->{username}, $self->{password},
--- sql//upgrade/sl2.8-1.3.sql.bu 2013-09-23 22:01:15.338012883 -0400
+++ sql/upgrade/sl2.8-1.3.sql 2013-09-23 22:15:52.322424950 -0400
@@ -1,9 +1,9 @@
--Setup
-- When moved to an interface, these will all be specified and preprocessed.
-\set default_country '''<?lsmb default_country ?>'''
-\set ar '''<?lsmb default_ar ?>'''
-\set ap '''<?lsmb default_ap ?>'''
+\set default_country '''us'''
+\set ar '''1200'''
+\set ap '''2100'''
BEGIN;
@@ -537,7 +537,11 @@
INSERT INTO user_preference(id)
SELECT id from users;
-INSERT INTO recurring SELECT * FROM sl28.recurring;
+INSERT INTO recurring(id, reference, startdate, nextdate, enddate, repeat,
+ unit, howmany, payment)
+ SELECT id, reference, startdate, nextdate, enddate, repeat,
+ unit, howmany, payment
+ FROM sl28.recurring;
INSERT INTO recurringemail SELECT * FROM sl28.recurringemail;