[freeside-users] New Customer reuses Customer ID, has old Invoice data

Kristian Hoffmann khoff at fire2wire.com
Thu Aug 10 10:10:57 PDT 2006


On Thu, 2006-08-10 at 11:36 -0500, John Gorkos wrote:
> I can tell you that I have never updated/deleted any record in the DB via 
> hand.  Since only one record is borked, can I manually find the highest 
> customer record currently assigned, make my new customer record one higher, 
> and then run fix-sequences?
> What other tables reference cust_main.custnum?  Scanning the schema, 
> cust_bill, h_cust_tax_exempt, cust_pay, cust_pay_batch, h_cust_main, 
> cust_credit, h_cust_main_invoice, cust_refund, h_cust_bill, cust_tax_exempt, 
> h_cust_package, h_cust_credit, h_cust_refund, cust_package, h_cust_pay, 
> cust_main_invoice.  All but cust_main  and cust_package seem to be billing or 
> invoice related.  If I assign the next sequence number to cust_main, and then 
> update cust_package to reflect the new custmain, I should be ok...

Sounds reasonable.

> When I run fix_sequences, all succeed save for:
> DBD::Pg::db do failed: ERROR:  relation "part_pkg_pkgpart_seq" does not exist 
> at ./fix-sequences line 59.
> ERROR:  relation "part_pkg_pkgpart_seq" does not exist at ./fix-sequences line 
> 59.
> 
> That leads me to believe my database is incomplete in some sense.  More 
> disturbing is that I have no sequence assigned for cust_main_custnum when I 
> \ds in psql and list all sequences.

One option is to manually create the sequences and set the column
defaults.  Another option would be to rename cust_main to something
else, recreate the cust_main table with the correct schema, and then do
a "INSERT INTO ... SELECT ...".  Taking that one step further, you could
make a data only backup, drop the database, and re-run freeside-setup to
regenerate a correct schema, and then restore your data.

> Any warnings before I jump for it?

Make a backup, or several for that matter.

Regards,

-- 
Kristian Hoffmann
Fire2Wire System Administrator
khoff at fire2wire.com
---




More information about the freeside-users mailing list