<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Manually creating the password_history table using the info from
the dryrun <br>
</p>
<p>CREATE TABLE password_history (<br>
passwordnum serial NOT NULL ,<br>
_password varchar(80) ,<br>
encryption_method varchar(80) ,<br>
created int ,<br>
svc_acct__svcnum int ,<br>
svc_dsl__svcnum int ,<br>
svc_alarm__svcnum int ,<br>
agent__agentnum int ,<br>
contact__contactnum int ,<br>
access_user__usernum int ,<br>
PRIMARY KEY (passwordnum)<br>
)<br>
;</p>
<p>Allows the upgrade to continue until it gets to upgrading
cust_main where it dies on a non-unique key. However the Record
referred to IS unique as below:<br>
</p>
<p>head /tmp/cust_location.csv<br>
locationnum,prospectnum,custnum,address1,address2,city,county,state,zip,latitude,longitude,coord_auto,addr_clean,country,geocode,district,censustract,censusyear,location_type,location_number,location_kind,disabled,locationname,incorporated<br>
<br>
</p>
<p>sort /tmp/cust_location.csv | grep 6, | more<br>
</p>
<p>650,,1643,1272
info,,removed,,ON,NOJ1GO,99.5616175,-96.9577946,Y,,CA,,,,,,,,,,<br>
6,,5,145 noway
,,Dallas,,CA,78945,43.0119437,-84.7411244,Y,,US,,,,,,,,,, (this
is the actual record as it is test data)<br>
653,,1646,1144
moreinfo,,nowhere,,ON,T4L3M9,35.5265261,-86.8689038,Y,,CA,,,,,,,,,,<br>
</p>
<p><-----SNIP------></p>
<p>tail of upgrade output<br>
</p>
<p>ALTER TABLE cust_main_exemption ADD FOREIGN KEY ( custnum )
REFERENCES cust_main ( custnum ) <br>
ALTER TABLE part_pkg_usageprice ADD FOREIGN KEY ( pkgpart )
REFERENCES part_pkg ( pkgpart ) <br>
ALTER TABLE cust_class ADD FOREIGN KEY ( categorynum ) REFERENCES
cust_category ( categorynum ) <br>
ALTER TABLE cust_bill_batch_option ADD FOREIGN KEY ( billbatchnum
) REFERENCES cust_bill_batch ( billbatchnum ) <br>
Schema upgrade completed in 8 seconds<br>
Application pruning completed in 0 seconds<br>
Re-initialization with updated schema completed in 5 seconds<br>
Custom fields data upgrade completed at /usr/bin/freeside-upgrade
line 401.<br>
Use of uninitialized value $total_new_charges in numeric gt (>)
at /usr/share/perl5/FS/Upgrade.pm line 152.<br>
Use of uninitialized value in pattern match (m//) at
/usr/share/perl5/FS/Upgrade.pm line 173.<br>
Use of uninitialized value $agentnum in join or string at
/usr/share/perl5/FS/Conf.pm line 362.<br>
Use of uninitialized value in join or string at
/usr/share/perl5/FS/Conf.pm line 362.<br>
Config updates completed in 0 seconds<br>
Upgrading part_event_condition...<br>
committing<br>
done in 0 seconds<br>
Upgrading part_event...<br>
committing<br>
done in 0 seconds<br>
Upgrading cust_main...<br>
DBD::Pg::st execute failed: ERROR: duplicate key value violates
unique constraint "cust_location_pkey"<br>
DETAIL: Key (locationnum)=(6) already exists. [for Statement
"INSERT INTO cust_location ( locationnum, custnum, address1, city,
state, zip, latitude, longitude, coord_auto, country) VALUES ('6',
'5', '145 noway ', 'Dallas', 'CA', '78945', '43.0119437',
'-84.7411244', 'Y', 'US')"] at /usr/share/perl5/FS/Record.pm line
1376.<br>
Error upgradging payment information for custnum 5: ERROR:
duplicate key value violates unique constraint
"cust_location_pkey"<br>
DETAIL: Key (locationnum)=(6) already exists. at
/usr/share/perl5/FS/cust_main.pm line 5720.<br>
<br>
</p>
<br>
<div class="moz-cite-prefix">On 10/12/2016 3:48 PM, Ian Fraser
wrote:<br>
</div>
<blockquote
cite="mid:c96598f8-c711-ce80-20a2-a4b99297061e@gozoom.ca"
type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
Thanks for the tips....<br>
<br>
The rt portion of the upgrade completed sudo su -l freeside -c
'/opt/rt3/sbin/rt-setup-database --dba freeside
--prompt-for-dba-password --action upgrade' without any errors<br>
<br>
And a dry run on the Freeside upgrade<br>
<br>
sudo su -l freeside -c '/usr/bin/freeside-upgrade -r -d fs_daily'<br>
<br>
appears to complete fine but when I try to actually implement the
upgrade it dies as below.<br>
<br>
guest@freeside4:/opt/rt3$ sudo su -l freeside -c
'/usr/bin/freeside-upgrade -r fs_daily'<br>
\Subroutine JSON::XS::Boolean::(-- redefined at
/usr/share/perl/5.20/overload.pm line 50.<br>
Subroutine JSON::XS::Boolean::(++ redefined at
/usr/share/perl/5.20/overload.pm line 50.<br>
Subroutine JSON::XS::Boolean::(0+ redefined at
/usr/share/perl/5.20/overload.pm line 50.<br>
FS::part_event::Condition::payby is disabled; skipping<br>
Upgrade startup completed in 3 seconds<br>
UPDATE cust_main SET agent_custid = NULL where agent_custid = ''<br>
UPDATE h_cust_main SET agent_custid = NULL where agent_custid = ''<br>
<br>
SELECT SETVAL( 'upgrade_journal_upgradenum_seq',<br>
( SELECT MAX(upgradenum) FROM upgrade_journal
)<br>
)<br>
<br>
Upgrading cust_bill_pkg_detail schema...<br>
committing<br>
done in 0 seconds<br>
Upgrading TicketSystem schema...<br>
committing<br>
done in 0 seconds<br>
Upgrading password_history schema...<br>
Can't call method "columns" on an undefined value at
/usr/share/perl5/FS/password_history.pm line 166.<br>
<br>
sub _upgrade_schema {<br>
# clean up history records where linked_acct has gone away<br>
my @where;<br>
for my $fk ( grep /__/, __PACKAGE__->dbdef_table->columns
) { <--- upgrade dies here<br>
my ($table, $key) = split(/__/, $fk);<br>
push @where, "<br>
( $fk IS NOT NULL AND NOT EXISTS(SELECT 1 FROM $table WHERE
$table.$key = $fk) )";<br>
}<br>
my @recs = qsearch({<br>
'table' => 'password_history',<br>
'extra_sql' => ' WHERE ' . join(' AND ', @where),<br>
});<br>
my $error;<br>
if (@recs) {<br>
warn "Removing unattached password_history records (<a
moz-do-not-send="true" class="moz-txt-link-rfc2396E"
href="mailto:.scalar%28@recs%29.">".scalar(@recs)."</a>).\n";<br>
foreach my $password_history (@recs) {<br>
$error = $password_history->delete;<br>
die $error if $error;<br>
}<br>
}<br>
'';<br>
<br>
<br>
<br>
<blockquote
cite="mid:a3edd602-de19-49e7-88a3-51f7c0026cda@gozoom.ca"
type="cite">
<div class="moz-cite-prefix">On 06/12/2016 1:22 AM, Erreu Gedmon
wrote:<br>
</div>
<blockquote
cite="mid:d6708053-e851-3426-e61f-7d404cbb049a@keyway.net"
type="cite">
<pre wrap="">I haven't tested it, but you could try something like this:
su -l freeside -c '/usr/bin/freeside-backup fs_daily' # create a backup, copy it to the 4.1 system
/etc/init.d/freeside stop ; pkill -f freeside ; systemctl stop apache2 ; systemsctl restart postgres # stop the 4.1 system
createdb -E UTF8 freeside' # create the database if it doesn't exist (I can't recall if this step is necessary)
su -l freeside -c 'pg_restore --dbname freeside -Fc freeside_backup.Pg' # restore the database
su -l freeside -c "freeside-upgrade fs_daily" # upgrade the 3.6 data to 4.1
/etc/init.d/freeside restart
Erreu Gedmon
--
"You see persons and things not as they are but as you are."
-- Anthony De Mello
On 12/05/2016 03:22 PM, Ian Fraser wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I have a production 3.6git instance of Freeside. 'Upgrading' a mirrored development copy has not gone well.
Is it possible to import a 3.6 db into a clean 4.1 install or a 4.1 VMWare image ?
Thanks,
Ian
_______________________________________________
freeside-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:freeside-users@freeside.biz">freeside-users@freeside.biz</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://freeside.biz/cgi-bin/mailman/listinfo/freeside-users">http://freeside.biz/cgi-bin/mailman/listinfo/freeside-users</a>
</pre>
</blockquote>
<pre wrap="">_______________________________________________
freeside-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:freeside-users@freeside.biz">freeside-users@freeside.biz</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://freeside.biz/cgi-bin/mailman/listinfo/freeside-users">http://freeside.biz/cgi-bin/mailman/listinfo/freeside-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ian Fraser
goZoom.ca Inc.
195 Libby's Rd. McNab-Braeside
K7S0E1
877(613) 622 0093 ext 21
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ian Fraser
goZoom.ca Inc.
195 Libby's Rd. McNab-Braeside
K7S0E1
877(613) 622 0093 ext 21
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
freeside-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:freeside-users@freeside.biz">freeside-users@freeside.biz</a>
<a class="moz-txt-link-freetext" href="http://freeside.biz/cgi-bin/mailman/listinfo/freeside-users">http://freeside.biz/cgi-bin/mailman/listinfo/freeside-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ian Fraser
goZoom.ca Inc.
195 Libby's Rd. McNab-Braeside
K7S0E1
877(613) 622 0093 ext 21
</pre>
</body>
</html>