finally fix part_svc!!!
[freeside.git] / httemplate / docs / upgrade8.html
1 <head>
2   <title>Upgrading to 1.4.0</title>
3 </head>
4 <body>
5 <h1>Upgrading to 1.4.0 from 1.3.1</h1>
6 <ul>
7   <li>If migrating from less than 1.3.1, see these <a href="upgrade7.html">instructions</a> first.
8   <li><font size="+2" color="#ff0000">Backup your database and current Freeside installation.</font> (with&nbsp;<a href="http://www.ca.postgresql.org/devel-corner/docs/postgres/backup.html">PostgreSQL</a>) (with&nbsp;<a href="http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Backup">MySQL</a>)
9   <li>Install <a href="http://www.apache-asp.org/">Apache::ASP</a> or <a href="http://www.masonhq.com/">HTML::Mason</a>.
10 </ul>
11 <table>
12   <tr>
13     <th>Apache::ASP</th><th>Mason</th>
14   </tr>
15   <tr>
16     <td><ul>
17       <li>Run <tt>make aspdocs</tt>
18       <li>Copy <tt>aspdocs/</tt> to your web server's document space.
19       <li>Create a <a href="http://www.apache-asp.org/config.html#Global">Global</a> directory, such as <tt>/usr/local/etc/freeside/asp-global/</tt>
20       <li>Copy <tt>htetc/global.asa</tt> to the Global directory.
21       <li>Configure Apache for the Global directory and to execute .cgi files using Apache::ASP.  For example:
22 <font size="-1"><pre>
23 &lt;Directory /usr/local/apache/htdocs/freeside-asp&gt;
24 &lt;Files ~ (\.cgi)&gt;
25 AddHandler perl-script .cgi
26 PerlHandler Apache::ASP
27 &lt;/Files&gt;
28 &lt;Perl&gt;
29 $MLDBM::RemoveTaint = 1;
30 &lt;/Perl&gt;
31 PerlSetVar Global /usr/local/etc/freeside/asp-global/
32 &lt;/Directory&gt;
33 </pre></font>
34     </ul></td>
35     <td><ul>
36       <li>Run <tt>make masondocs</tt>
37       <li>Copy <tt>masondocs/</tt> to your web server's document space.
38       <li>Copy <tt>htetc/handler.pl</tt> to your web server's configuration directory.
39       <li>Edit <tt>handler.pl</tt> and set an appropriate <tt>data_dir</tt>, such as <tt>/usr/local/etc/freeside/mason-data</tt>
40       <li>Configure Apache to use the <tt>handler.pl</tt> file and to execute .cgi files using HTML::Mason.  For example:
41 <font size="-1"><pre>
42 &lt;Directory /usr/local/apache/htdocs/freeside-mason&gt;
43 &lt;Files ~ (\.cgi)&gt;
44 AddHandler perl-script .cgi
45 PerlHandler HTML::Mason
46 &lt;/Files&gt;
47 &lt;Perl&gt;
48 require "/usr/local/apache/conf/handler.pl";
49 &lt;/Perl&gt;
50 &lt;/Directory&gt;
51 </pre></font>
52     </ul></td>
53   </tr>
54 </table>
55 <ul>
56   <li>Change to the FS directory in the new tarball, and build and install the
57       Perl modules:
58     <pre>
59 $ cd FS/
60 $ perl Makefile.PL
61 $ make
62 $ su
63 # make install UNINST=1</pre>
64    <li>Apply the following changes to your database:
65 <pre>
66 CREATE TABLE svc_forward (
67   svcnum int NOT NULL,
68   srcsvc int NOT NULL,
69   dstsvc int NOT NULL,
70   dst varchar(80),
71   PRIMARY KEY (svcnum)
72 );
73
74 CREATE TABLE cust_credit_bill (
75   creditbillnum int primary key,
76   crednum int not null,
77   invnum int not null,
78   _date int not null,
79   amount decimal(10,2) not null
80 );
81
82 CREATE TABLE cust_bill_pay (
83   billpaynum int primary key,
84   invnum int not null,
85   paynum int not null,
86   _date int not null,
87   amount decimal(10,2) not null
88 );
89
90 CREATE TABLE cust_credit_refund (
91   creditrefundnum int primary key,
92   crednum int not null,
93   refundnum int not null,
94   _date int not null,
95   amount decimal(10,2) not null
96 );
97
98 CREATE TABLE part_svc_column (
99   columnnum int primary key,
100   svcpart int not null,
101   columnname varchar(64) not null,
102   columnvalue varchar(80) null,
103   columnflag char(1) null
104 );
105
106
107 ALTER TABLE svc_acct ADD domsvc integer NOT NULL;
108 ALTER TABLE svc_domain ADD catchall integer NULL;
109 ALTER TABLE cust_main ADD referral_custnum integer NULL;
110 ALTER TABLE cust_pay ADD custnum integer;
111 ALTER TABLE cust_refund ADD custnum integer;
112 CREATE INDEX cust_main3 ON cust_main ( referral_custnum );
113 CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum );
114 CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum );
115 CREATE INDEX cust_bill_pay1 ON cust_bill_pay ( invnum );
116 CREATE INDEX cust_bill_pay2 ON cust_bill_pay ( paynum );
117 CREATE INDEX cust_credit_refund1 ON cust_credit_refund ( crednum );
118 CREATE INDEX cust_credit_refund2 ON cust_credit_refund ( refundnum );
119 CREATE UNIQUE INDEX part_svc_column1 ON part_svc_column ( svcpart, columnname );
120 </pre>
121
122   <li>If you are using PostgreSQL, apply the following changes to your database:
123 <pre>
124 CREATE UNIQUE INDEX agent_pkey ON agent ( agentnum );
125 CREATE UNIQUE INDEX agent_type_pkey agent_type ( typenum );
126 CREATE UNIQUE INDEX cust_bill_pkey ON cust_bill ( invnum );
127 CREATE UNIQUE INDEX cust_credit_pkey ON cust_credit ( crednum );
128 CREATE UNIQUE INDEX cust_main_pkey ON cust_main ( custnum );
129 CREATE UNIQUE INDEX cust_main_county_pkey ON cust_main_county ( taxnum );
130 CREATE UNIQUE INDEX cust_main_invoice_pkey ON cust_main_invoice ( destnum );
131 CREATE UNIQUE INDEX cust_pay_pkey ON cust_pay ( paynum );
132 CREATE UNIQUE INDEX cust_pkg_pkey ON cust_pkg ( pkgnum );
133 CREATE UNIQUE INDEX cust_refund_pkey ON cust_refund ( refundnum );
134 CREATE UNIQUE INDEX cust_svc_pkey ON cust_svc ( svcnum );
135 CREATE UNIQUE INDEX domain_record_pkey ON domain_record ( recnum );
136 CREATE UNIQUE INDEX nas_pkey ON nas ( nasnum );
137 CREATE UNIQUE INDEX part_pkg_pkey ON part_pkg ( pkgpart );
138 CREATE UNIQUE INDEX part_referral_pkey ON part_referral ( refnum );
139 CREATE UNIQUE INDEX part_svc_pkey ON part_svc ( svcpart );
140 CREATE UNIQUE INDEX port_pkey ON port ( portnum );
141 CREATE UNIQUE INDEX prepay_credit_pkey ON prepay_credit ( prepaynum );
142 CREATE UNIQUE INDEX session_pkey ON session ( sessionnum );
143 CREATE UNIQUE INDEX svc_acct_pkey ON svc_acct ( svcnum );
144 CREATE UNIQUE INDEX svc_acct_pop_pkey ON svc_acct_pop ( popnum );
145 CREATE UNIQUE INDEX svc_acct_sm_pkey ON svc_acct_sm ( svcnum );
146 CREATE UNIQUE INDEX svc_domain_pkey ON svc_domain ( svcnum );
147 CREATE UNIQUE INDEX svc_www_pkey ON svc_www ( svcnum );
148 CREATE UNIQUE INDEX type_pkgs_pkey ON type_pkgs ( typenum );
149 </pre>
150   <li>If you wish to enable service/shipping addresses, apply the following
151       changes to your database:
152 <pre>
153 ALTER TABLE cust_main ADD COLUMN ship_last varchar(80) NULL;
154 ALTER TABLE cust_main ADD COLUMN ship_first varchar(80) NULL;
155 ALTER TABLE cust_main ADD COLUMN ship_company varchar(80) NULL;
156 ALTER TABLE cust_main ADD COLUMN ship_address1 varchar(80) NULL;
157 ALTER TABLE cust_main ADD COLUMN ship_address2 varchar(80) NULL;
158 ALTER TABLE cust_main ADD COLUMN ship_city varchar(80) NULL;
159 ALTER TABLE cust_main ADD COLUMN ship_county varchar(80) NULL;
160 ALTER TABLE cust_main ADD COLUMN ship_state varchar(80) NULL;
161 ALTER TABLE cust_main ADD COLUMN ship_zip varchar(10) NULL;
162 ALTER TABLE cust_main ADD COLUMN ship_country char(2) NULL;
163 ALTER TABLE cust_main ADD COLUMN ship_daytime varchar(20) NULL;
164 ALTER TABLE cust_main ADD COLUMN ship_night varchar(20) NULL;
165 ALTER TABLE cust_main ADD COLUMN ship_fax varchar(12) NULL;
166 CREATE INDEX cust_main1 ON cust_main ( ship_last );
167 CREATE INDEX cust_main2 ON cust_main ( ship_company );
168 </pre>
169   <li>If you wish to enable customer comments, apply the following change to
170       your database:
171 <pre>
172 ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
173 </pre>
174   <li>If you are using the signup server, reinstall it according to the <a href="signup.html">instructions</a>.  The 1.3.x signup server is not compatible with 1.4.x.
175   <li>Run bin/dbdef-create.
176   <li>create a service based on svc_forward
177   <li>Run bin/fs-migrate-svc_acct_sm
178   <li>Run bin/fs-migrate-payref
179   <li>Run bin/fs-migrate-part_svc
180   <li><b>After running bin/fs-migrate-payref</b>, apply the following changes to your database:
181   <table border><tr><th>PostgreSQL</th><th>MySQL, others</th></tr>
182 <tr><td>
183 <font size=-1><pre>
184 CREATE TABLE cust_pay_temp (
185   paynum int primary key,
186   custnum int not null,
187   paid decimal(10,2) not null,
188   _date int null,
189   payby char(4) not null,
190   payinfo varchar(16) null,
191   paybatch varchar(80) null
192 );
193 INSERT INTO cust_pay_temp SELECT * from cust_pay;
194 DROP TABLE cust_pay;
195 ALTER TABLE cust_pay_temp RENAME TO cust_pay;
196 CREATE UNIQUE INDEX cust_pay1 ON cust_pay paynum;
197 CREATE TABLE cust_refund_temp (
198   refundnum int primary key,
199   custnum int not null,
200   _date int null,
201   refund decimal(10,2) not null,
202   otaker varchar(8) not null,
203   reason varchar(80) not null,
204   payby char(4) not null,
205   payinfo varchar(16) null,
206   paybatch varchar(80) null
207 );
208 INSERT INTO cust_refund_temp SELECT * from cust_refund;
209 DROP TABLE cust_refund;
210 ALTER TABLE cust_refund_temp RENAME TO cust_refund;
211 CREATE UNIQUE INDEX cust_refund1 ON cust_refund refundnum;
212 </pre></font>
213 </td><td>
214 <font size=-1><pre>
215 ALTER TABLE cust_pay DROP COLUMN invnum;
216 ALTER TABLE cust_refund DROP COLUMN crednum;
217 </pre></font>
218 </td></tr></table>
219   <li><b>IMPORTANT: After applying the second set of database changes</b>, run bin/dbdef-create again.
220   <li>create the conf.dbsrc/user_policy as appropriate for your site
221 </body>