first stab at BoM download
[freeside.git] / httemplate / docs / upgrade10.html
index d7a8c74..2a4b0d9 100644 (file)
+<head>
+  <title>Upgrading to 1.5.8</title>
+</head>
+<body>
+<h1>Upgrading to 1.5.8 from 1.4.1 or 1.4.2</h1
+
+<table bgcolor="#dddddd">
+<tr><td>
+<i><b>Note:</b> Version numbering has been simplified.  1.5.7 and 1.5.8 are the
+versions following 1.5.0pre6.  They are still development versions - releases
+with odd numbered middle parts (NN in x.NN.x) are development versions, like
+Perl or Linux.
+</td></tr>
+</table>
+<br>
+
+<ul>
+  <li>If migrating from 1.5.0pre6, see README.1.5.7 instead
+  <li>If migrating from 1.5.7, see README.1.5.8 instead
+  <li> install DBD::Pg 1.32, 1.41 or later (not 1.40) (or, if you're using a Perl version before 5.6, you could try installing DBD::Pg 1.22 with <a href="http://420.am/~ivan/DBD-Pg-1.22-fixvercmp.patch">this patch</a> and commenting out the "use DBD::Pg 1.32" at the top of DBIx/DBSchema/DBD/Pg.pm)
+  <li> install DBIx::DBSchema 0.27 (or later) (if you are running Pg version 7.2.x or earlier, install at least DBIx::DBSchema 0.29)
+  <li> install Net::SSH 0.08 or later
+  <li> install HTML::Widgets::SelectLayers 0.05 or later
+  <li> install Business::CreditCard 0.28 or later
+
+  <li>If using Apache::ASP, add PerlSetVar RequestBinaryRead Off and PerlSetVar IncludesDir /your/freeside/document/root/ to your Apache configuration and make sure you are using Apache::ASP minimum version 2.55.
+    <ul>
+      <li>In httpd.conf, change &lt;Files ~ \.cgi&gt; to  &lt;Files ~ (\.cgi|\.html)&gt;
+      <li>In httpd.conf, change <b>AddHandler perl-script .cgi</b> or <b>SetHandler perl-script</b> to <b>AddHandler perl-script .cgi .html</b>
+    </ul>
+  <li>install NetAddr::IP, Chart::Base, Locale::SubCountry, Text::CSV_XS, 
+Spreadsheet::WriteExcel, IO-stringy (IO::Scalar), Frontier::RPC
+(Frontier::RPC2), MIME::Entity (MIME-tools), IPC::Run3, Net::Whois::Raw,
+JSON, Term::ReadKey and Color::Scheme
+<!-- and Crypt::YAPassGen-->
+
+  <li>Apply the following changes to your database:
 <pre>
-this is incomplete
+INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 20, 'svc_external-id', 'en_US', 'External ID' );
+INSERT INTO msgcat ( msgnum, msgcode, locale, msg ) VALUES ( 21, 'svc_external-title', 'en_US', 'Title' );
 
-install DBIx::DBSchema 0.21
-
-install NetAddr::IP and Chart::Base
-
-CREATE TABLE cust_bill_pkg_detail (
-  detailnum serial,
-  pkgnum int NOT NULL,
-  invnum int NOT NULL,
-  detail varchar(80),
-  PRIMARY KEY (detailnum)
-);
-CREATE INDEX cust_bill_pkg_detail1 ON cust_bill_pkg_detail ( pkgnum, invnum );
-
-CREATE TABLE part_virtual_field (
-  vfieldpart int NOT NULL,
-  dbtable varchar(32) NOT NULL,
-  name varchar(32) NOT NULL,
-  check_block text,
-  list_source text,
-  length integer,
-  label varchar(80),
-  PRIMARY KEY (vfieldpart)
-);
-
-CREATE TABLE virtual_field (
-  recnum integer NOT NULL,
-  vfieldpart integer NOT NULL,
-  value varchar(128) NOT NULL,
-  PRIMARY KEY (vfieldpart, recnum)
-);
-
-CREATE TABLE router (
-  routernum serial,
-  routername varchar(80),
-  svcnum int,
-  PRIMARY KEY (routernum)
-);
-
-CREATE TABLE part_svc_router (
-  svcpart int NOT NULL,
-  routernum int NOT NULL
-);
-
-CREATE TABLE addr_block (
-  blocknum serial,
-  routernum int NOT NULL,
-  ip_gateway varchar(15) NOT NULL,
-  ip_netmask int NOT NULL,
-  PRIMARY KEY (blocknum)
-);
-CREATE UNIQUE INDEX addr_block1 ON addr_block ( blocknum, routernum );
-
-CREATE TABLE svc_broadband (
-  svcnum int NOT NULL,
-  blocknum int NOT NULL,
-  speed_up int NOT NULL,
-  speed_down int NOT NULL,
-  ip_addr varchar(15),
-  PRIMARY KEY (svcnum)
-);
-
-DELETE INDEX cust_bill_pkg1;
-
-ALTER TABLE cust_bill_pkg ADD itemdesc varchar(80) NULL;
-ALTER TABLE h_cust_bill_pkg ADD itemdesc varchar(80) NULL;
-ALTER TABLE cust_main_county ADD taxname varchar(80) NULL;
-ALTER TABLE h_cust_main_county ADD taxname varchar(80) NULL;
-ALTER TABLE cust_pkg ADD last_bill int NULL;
-ALTER TABLE h_cust_pkg ADD last_bill int NULL;
-
-dump database, edit:
-- cust_main: increase otaker from 8 to 32
-- cust_main: change ss from char(11) to varchar(11)
-- cust_credit: increase otaker from 8 to 32
-- cust_pkg: increase otaker from 8 to 32
-- cust_refund: increase otaker from 8 to 32
-- domain_record: increase reczone from 80 to 255
-- domain_record: change rectype from char to varchar
-- domain_record: increase recdata from 80 to 255
-then reload
-
-optionally:
-
-  CREATE INDEX cust_main6 ON cust_main ( daytime );
-  CREATE INDEX cust_main7 ON cust_main ( night );
-  CREATE INDEX cust_main8 ON cust_main ( fax );
-  CREATE INDEX cust_main9 ON cust_main ( ship_daytime );
-  CREATE INDEX cust_main10 ON cust_main ( ship_night );
-  CREATE INDEX cust_main11 ON cust_main ( ship_fax );
+DROP INDEX cust_bill_pkg1;
+</pre>
 
-  serial columns
+  <li>On recent Pg versions:
+<pre>
+ALTER TABLE cust_main ALTER COLUMN payinfo varchar(512) NULL;
+ALTER TABLE h_cust_main ALTER COLUMN payinfo varchar(512) NULL;
+ALTER TABLE cust_pay_batch ADD COLUMN batchnum int NOT NULL;
+ALTER TABLE cust_pay_batch ALTER COLUMN batchnum SET NOT NULL;
+ALTER TABLE cust_pay_batch ADD COLUMN payinfo varchar(512) NULL;
+UPDATE cust_pay_batch SET payinfo = cardnum;
+ALTER TABLE cust_pay_batch DROP COLUMN cardnum;
+ALTER TABLE h_cust_pay_batch ADD COLUMN payinfo varchar(512) NULL;
+UPDATE h_cust_pay_batch SET payinfo = cardnum;
+ALTER TABLE h_cust_pay_batch DROP COLUMN cardnum;
+</pre>
+On older Pg versions that don't support altering columns directly, you will need to dump the database, edit the schema definitions in the dump file, and reload.
 
-mandatory again:
+  <li>On recent Pg versions:
+<pre>
+ALTER TABLE svc_forward ALTER COLUMN srcsvc DROP NOT NULL;
+ALTER TABLE h_svc_forward ALTER COLUMN srcsvc DROP NOT NULL;
+ALTER TABLE svc_forward ALTER COLUMN dstsvc DROP NOT NULL;
+ALTER TABLE h_svc_forward ALTER COLUMN dstsvc DROP NOT NULL;
+ALTER TABLE cust_main ALTER COLUMN zip DROP NOT NULL;
+ALTER TABLE h_cust_main ALTER COLUMN zip DROP NOT NULL;
+</pre>
+Or on Pg versions that don't support DROP NOT NULL (tested on 7.1 and 7.2 so far):
+<pre>
+UPDATE pg_attribute SET attnotnull = FALSE WHERE ( attname = 'srcsvc' OR attname = 'dstsvc' ) AND ( attrelid = ( SELECT oid FROM pg_class WHERE relname = 'svc_forward' ) OR attrelid = ( SELECT oid FROM pg_class WHERE relname = 'h_svc_forward' ) );
+UPDATE pg_attribute SET attnotnull = FALSE WHERE ( attname = 'zip' ) AND ( attrelid = ( SELECT oid FROM pg_class WHERE relname = 'cust_main' ) OR attrelid = ( SELECT oid FROM pg_class WHERE relname = 'h_cust_main' ) );
+</pre>
 
-dbdef-create username
-create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband
-dbdef-create username
+  <li> If you created your database with a version before 1.4.2, dump database, edit the following, then reload:
+    <ul>
+      <li>cust_main and h_cust_main: increase otaker from 8 to 32
+      <li>cust_main and h_cust_main: change ss from char(11) to varchar(11) ( "character(11)" to "character varying(11)" )
+      <li>cust_credit and h_cust_credit: increase otaker from 8 to 32
+      <li>cust_pkg and h_cust_pkg: increase otaker from 8 to 32
+      <li>cust_refund and h_cust_refund: increase otaker from 8 to 32
+      <li>domain_record and h_domain_record: increase reczone from 80 to 255
+      <li>domain_record and h_domain_record: change rectype from char to varchar ( "character(5)" to "character varying(5)" )
+      <li>domain_record and h_domain_record: increase recdata from 80 to 255
+    </ul>
+
+<li>make install-perl-modules to install the new libraries and CLI utilities
+<li>run "freeside-upgrade username" to create the remaining new tables and columns
+
+<li>optionally:
+<pre>
+CREATE INDEX cust_main4 ON cust_main ( daytime );
+CREATE INDEX cust_main5 ON cust_main ( night );
+CREATE INDEX cust_main6 ON cust_main ( fax );
+CREATE INDEX cust_main7 ON cust_main ( refnum );
+CREATE INDEX cust_main8 ON cust_main ( county );
+CREATE INDEX cust_main9 ON cust_main ( state );
+CREATE INDEX cust_main10 ON cust_main ( country );
+CREATE INDEX cust_main11 ON cust_main ( ship_last );
+CREATE INDEX cust_main12 ON cust_main ( ship_company );
+CREATE INDEX cust_main13 ON cust_main ( ship_daytime );
+CREATE INDEX cust_main14 ON cust_main ( ship_night );
+CREATE INDEX cust_main15 ON cust_main ( ship_fax );
+CREATE INDEX agent2 ON agent ( disabled );
+CREATE INDEX part_bill_event2 ON part_bill_event ( disabled );
+CREATE INDEX cust_pay4 ON cust_pay (_date);
+CREATE INDEX part_referral1 ON part_referral ( disabled );
+CREATE INDEX part_pkg2 ON part_pkg ( promo_code );
+CREATE INDEX h_part_pkg2 ON h_part_pkg ( promo_code );
+</pre>
 
-apache - fix <Files> sections to include .html also
+</ul>
 
-</pre>
+</body>
+</html>