Difference between revisions of "Freeside talk:1.7:Documentation:Upgrading"

From Freeside
Jump to: navigation, search
(reverting spam)
 
(16 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
== int->bigint for the byte counting stuff ==
 
== int->bigint for the byte counting stuff ==
  
clear; t=svc_acct; for c in upbytes upbytes_threshold downbytes downbytes_threshold totalbytes totalbytes_threshold; do echo "ALTER TABLE $t ADD COLUMN ${c}_new bigint;
+
<pre>
 +
 
 +
clear; for t in svc_acct h_svc_acct; do for c in upbytes upbytes_threshold downbytes downbytes_threshold totalbytes totalbytes_threshold; do echo "BEGIN WORK;
 +
ALTER TABLE $t ADD COLUMN ${c}_new bigint;
 
UPDATE $t SET ${c}_new = CAST($c AS bigint);
 
UPDATE $t SET ${c}_new = CAST($c AS bigint);
ALTER TABLE $t DROP COLUMN $c;
+
ALTER TABLE $t DROP COLUMN $c;  
 
 
 
ALTER TABLE $t RENAME COLUMN ${c}_new TO $c;
 
ALTER TABLE $t RENAME COLUMN ${c}_new TO $c;
"; done
+
COMMIT WORK;
 +
"; done; done
  
clear; t=prepay_credit; for c in upbytes downbytes totalbytes; do echo "ALTER TABLE $t ADD COLUMN ${c}_new bigint;
+
clear; for t in prepay_credit h_prepay_credit; do for c in upbytes downbytes totalbytes; do echo "BEGIN WORK;
 +
ALTER TABLE $t ADD COLUMN ${c}_new bigint;
 
UPDATE $t SET ${c}_new = CAST($c AS bigint);
 
UPDATE $t SET ${c}_new = CAST($c AS bigint);
 
ALTER TABLE $t DROP COLUMN $c;
 
ALTER TABLE $t DROP COLUMN $c;
 
ALTER TABLE $t RENAME COLUMN ${c}_new TO $c;
 
ALTER TABLE $t RENAME COLUMN ${c}_new TO $c;
"; done
+
COMMIT WORK;
 +
"; done; done
 +
</pre>
  
 
== bigger payinfo fields for encryption ==
 
== bigger payinfo fields for encryption ==
  
 +
<pre>
 
ALTER TABLE cust_main ADD payinfo_new varchar(512);
 
ALTER TABLE cust_main ADD payinfo_new varchar(512);
 
UPDATE cust_main SET payinfo_new = payinfo;
 
UPDATE cust_main SET payinfo_new = payinfo;
Line 43: Line 50:
 
ALTER TABLE h_cust_pay ADD payinfo_new varchar(512);
 
ALTER TABLE h_cust_pay ADD payinfo_new varchar(512);
 
UPDATE h_cust_pay SET payinfo_new = payinfo;
 
UPDATE h_cust_pay SET payinfo_new = payinfo;
ALTER TABLE h_cust_pay DROP payinfo
+
ALTER TABLE h_cust_pay DROP payinfo;
 
ALTER TABLE h_cust_pay RENAME payinfo_new TO payinfo;
 
ALTER TABLE h_cust_pay RENAME payinfo_new TO payinfo;
  
Line 54: Line 61:
 
ALTER TABLE h_cust_pay_void ADD payinfo_new varchar(512);
 
ALTER TABLE h_cust_pay_void ADD payinfo_new varchar(512);
 
UPDATE h_cust_pay_void SET payinfo_new = payinfo;
 
UPDATE h_cust_pay_void SET payinfo_new = payinfo;
ALTER TABLE h_cust_pay_void DROP payinfo
+
ALTER TABLE h_cust_pay_void DROP payinfo;
 
ALTER TABLE h_cust_pay_void RENAME payinfo_new TO payinfo;
 
ALTER TABLE h_cust_pay_void RENAME payinfo_new TO payinfo;
  
Line 65: Line 72:
 
ALTER TABLE h_cust_pay_batch ADD payinfo_new varchar(512);
 
ALTER TABLE h_cust_pay_batch ADD payinfo_new varchar(512);
 
UPDATE h_cust_pay_batch SET payinfo_new = payinfo;
 
UPDATE h_cust_pay_batch SET payinfo_new = payinfo;
ALTER TABLE h_cust_pay_batch DROP payinfo
+
ALTER TABLE h_cust_pay_batch DROP payinfo;
 
ALTER TABLE h_cust_pay_batch RENAME payinfo_new TO payinfo;
 
ALTER TABLE h_cust_pay_batch RENAME payinfo_new TO payinfo;
  
Line 76: Line 83:
 
ALTER TABLE h_cust_refund ADD payinfo_new varchar(512);
 
ALTER TABLE h_cust_refund ADD payinfo_new varchar(512);
 
UPDATE h_cust_refund SET payinfo_new = payinfo;
 
UPDATE h_cust_refund SET payinfo_new = payinfo;
ALTER TABLE h_cust_refund DROP payinfo
+
ALTER TABLE h_cust_refund DROP payinfo;
 
ALTER TABLE h_cust_refund RENAME payinfo_new TO payinfo;
 
ALTER TABLE h_cust_refund RENAME payinfo_new TO payinfo;
 +
</pre>
 +
 +
== bigger _password fields for weird LDAP encodings ==
 +
 +
<pre>
 +
ALTER TABLE svc_acct ADD _password_new varchar(512) NOT NULL;
 +
UPDATE svc_acct SET _password_new = _password;
 +
ALTER TABLE svc_acct DROP _password;
 +
ALTER TABLE svc_acct RENAME _password_new TO _password;
 +
 +
ALTER TABLE h_svc_acct ADD _password_new varchar(512) NOT NULL;
 +
UPDATE h_svc_acct SET _password_new = _password;
 +
ALTER TABLE h_svc_acct DROP _password;
 +
ALTER TABLE h_svc_acct RENAME _password_new TO _password;
 +
</pre>
 +
 +
== Issues with freeside-upgrade  ==
 +
 +
I had lots of issues while trying to run freeside-upgrade.  The fix I finally made work was to run the script as follows
 +
 +
freeside-upgrade -d username > dbupdatefile
 +
 +
and then manually dump the dbupdatefile to psql
 +
 +
psql -f dbupdatefile
 +
 +
''It would be helpful if you could document said "issues" here, or in the forum, or on the mailing list, rather than only documenting their existence and a workaround.  That way someone encountering the same problem might provide a fix so that the script works as intended for you.  FWIW, freeside-upgrade has  worked for myself and others for many upgrades to date.''

Latest revision as of 17:13, 25 July 2009

int->bigint for the byte counting stuff


clear; for t in svc_acct h_svc_acct; do for c in upbytes upbytes_threshold downbytes downbytes_threshold totalbytes totalbytes_threshold; do echo "BEGIN WORK;
ALTER TABLE $t ADD COLUMN ${c}_new bigint;
UPDATE $t SET ${c}_new = CAST($c AS bigint);
ALTER TABLE $t DROP COLUMN $c; 
ALTER TABLE $t RENAME COLUMN ${c}_new TO $c;
COMMIT WORK;
"; done; done

clear; for t in prepay_credit h_prepay_credit; do for c in upbytes downbytes totalbytes; do echo "BEGIN WORK;
ALTER TABLE $t ADD COLUMN ${c}_new bigint;
UPDATE $t SET ${c}_new = CAST($c AS bigint);
ALTER TABLE $t DROP COLUMN $c;
ALTER TABLE $t RENAME COLUMN ${c}_new TO $c;
COMMIT WORK;
"; done; done

bigger payinfo fields for encryption

ALTER TABLE cust_main ADD payinfo_new varchar(512);
UPDATE cust_main SET payinfo_new = payinfo;
ALTER TABLE cust_main DROP payinfo;
ALTER TABLE cust_main RENAME payinfo_new TO payinfo;

ALTER TABLE cust_main ADD paycvv_new varchar(512);
UPDATE cust_main SET paycvv_new = paycvv;
ALTER TABLE cust_main DROP paycvv;
ALTER TABLE cust_main RENAME paycvv_new TO paycvv;

ALTER TABLE h_cust_main ADD payinfo_new varchar(512);
UPDATE h_cust_main SET payinfo_new = payinfo;
ALTER TABLE h_cust_main DROP payinfo;
ALTER TABLE h_cust_main RENAME payinfo_new TO payinfo;

ALTER TABLE h_cust_main ADD paycvv_new varchar(512);
UPDATE h_cust_main SET paycvv_new = paycvv;
ALTER TABLE h_cust_main DROP paycvv;
ALTER TABLE h_cust_main RENAME paycvv_new TO paycvv;

ALTER TABLE cust_pay ADD payinfo_new varchar(512);
UPDATE cust_pay SET payinfo_new = payinfo;
ALTER TABLE cust_pay DROP payinfo;
ALTER TABLE cust_pay RENAME payinfo_new TO payinfo;

ALTER TABLE h_cust_pay ADD payinfo_new varchar(512);
UPDATE h_cust_pay SET payinfo_new = payinfo;
ALTER TABLE h_cust_pay DROP payinfo;
ALTER TABLE h_cust_pay RENAME payinfo_new TO payinfo;


ALTER TABLE cust_pay_void ADD payinfo_new varchar(512);
UPDATE cust_pay_void SET payinfo_new = payinfo;
ALTER TABLE cust_pay_void DROP payinfo;
ALTER TABLE cust_pay_void RENAME payinfo_new TO payinfo;

ALTER TABLE h_cust_pay_void ADD payinfo_new varchar(512);
UPDATE h_cust_pay_void SET payinfo_new = payinfo;
ALTER TABLE h_cust_pay_void DROP payinfo;
ALTER TABLE h_cust_pay_void RENAME payinfo_new TO payinfo;


ALTER TABLE cust_pay_batch ADD payinfo_new varchar(512);
UPDATE cust_pay_batch SET payinfo_new = payinfo;
ALTER TABLE cust_pay_batch DROP payinfo;
ALTER TABLE cust_pay_batch RENAME payinfo_new TO payinfo;

ALTER TABLE h_cust_pay_batch ADD payinfo_new varchar(512);
UPDATE h_cust_pay_batch SET payinfo_new = payinfo;
ALTER TABLE h_cust_pay_batch DROP payinfo;
ALTER TABLE h_cust_pay_batch RENAME payinfo_new TO payinfo;


ALTER TABLE cust_refund ADD payinfo_new varchar(512);
UPDATE cust_refund SET payinfo_new = payinfo;
ALTER TABLE cust_refund DROP payinfo;
ALTER TABLE cust_refund RENAME payinfo_new TO payinfo;

ALTER TABLE h_cust_refund ADD payinfo_new varchar(512);
UPDATE h_cust_refund SET payinfo_new = payinfo;
ALTER TABLE h_cust_refund DROP payinfo;
ALTER TABLE h_cust_refund RENAME payinfo_new TO payinfo;

bigger _password fields for weird LDAP encodings

ALTER TABLE svc_acct ADD _password_new varchar(512) NOT NULL;
UPDATE svc_acct SET _password_new = _password;
ALTER TABLE svc_acct DROP _password;
ALTER TABLE svc_acct RENAME _password_new TO _password;

ALTER TABLE h_svc_acct ADD _password_new varchar(512) NOT NULL;
UPDATE h_svc_acct SET _password_new = _password;
ALTER TABLE h_svc_acct DROP _password;
ALTER TABLE h_svc_acct RENAME _password_new TO _password;

Issues with freeside-upgrade

I had lots of issues while trying to run freeside-upgrade. The fix I finally made work was to run the script as follows

freeside-upgrade -d username > dbupdatefile

and then manually dump the dbupdatefile to psql

psql -f dbupdatefile

It would be helpful if you could document said "issues" here, or in the forum, or on the mailing list, rather than only documenting their existence and a workaround. That way someone encountering the same problem might provide a fix so that the script works as intended for you. FWIW, freeside-upgrade has worked for myself and others for many upgrades to date.