mason warnings
[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>NOTE: Mason support is still a bit buggy in the 1.4.0 prereleases.  This will be fixed before 1.4.0.  You have been warned.
37       <li>Run <tt>make masondocs</tt>
38       <li>Copy <tt>masondocs/</tt> to your web server's document space.
39       <li>Copy <tt>htetc/handler.pl</tt> to your web server's configuration directory.
40       <li>Edit <tt>handler.pl</tt> and set an appropriate <tt>data_dir</tt>, such as <tt>/usr/local/etc/freeside/mason-data</tt>
41       <li>Configure Apache to use the <tt>handler.pl</tt> file and to execute .cgi files using HTML::Mason.  For example:
42 <font size="-1"><pre>
43 &lt;Directory /usr/local/apache/htdocs/freeside-mason&gt;
44 &lt;Files ~ (\.cgi)&gt;
45 AddHandler perl-script .cgi
46 PerlHandler HTML::Mason
47 &lt;/Files&gt;
48 &lt;Perl&gt;
49 require "/usr/local/apache/conf/handler.pl";
50 &lt;/Perl&gt;
51 &lt;/Directory&gt;
52 </pre></font>
53     </ul></td>
54   </tr>
55 </table>
56 <ul>
57   <li>Change to the FS directory in the new tarball, and build and install the
58       Perl modules:
59     <pre>
60 $ cd FS/
61 $ perl Makefile.PL
62 $ make
63 $ su
64 # make install UNINST=1</pre>
65    <li>Apply the following changes to your database:
66 <pre>
67 CREATE TABLE svc_forward (
68   svcnum int NOT NULL,
69   srcsvc int NOT NULL,
70   dstsvc int NOT NULL,
71   dst varchar(80),
72   PRIMARY KEY (svcnum)
73 );
74
75 CREATE TABLE cust_credit_bill (
76   creditbillnum int primary key,
77   crednum int not null,
78   invnum int not null,
79   _date int not null,
80   amount decimal(10,2) not null
81 );
82
83 CREATE TABLE cust_bill_pay (
84   billpaynum int primary key,
85   invnum int not null,
86   paynum int not null,
87   _date int not null,
88   amount decimal(10,2) not null
89 );
90
91 CREATE TABLE cust_credit_refund (
92   creditrefundnum int primary key,
93   crednum int not null,
94   refundnum int not null,
95   _date int not null,
96   amount decimal(10,2) not null
97 );
98
99 CREATE TABLE part_svc_column (
100   columnnum int primary key,
101   svcpart int not null,
102   columnname varchar(64) not null,
103   columnvalue varchar(80) null,
104   columnflag char(1) null
105 );
106
107 CREATE TABLE queue (
108   jobnum int primary key,
109   job varchar not null,
110   _date int not null,
111   status varchar(80) not null
112 );
113
114 CREATE TABLE queue_arg (
115   argnum int primary key,
116   jobnum int not null,
117   arg varchar null
118 );
119 CREATE INDEX queue_arg1 ON queue_arg ( jobnum );
120
121 ALTER TABLE svc_acct ADD domsvc integer NOT NULL;
122 ALTER TABLE svc_domain ADD catchall integer NULL;
123 ALTER TABLE cust_main ADD referral_custnum integer NULL;
124 ALTER TABLE cust_pay ADD custnum integer;
125 ALTER TABLE cust_refund ADD custnum integer;
126 CREATE INDEX cust_main3 ON cust_main ( referral_custnum );
127 CREATE INDEX cust_credit_bill1 ON cust_credit_bill ( crednum );
128 CREATE INDEX cust_credit_bill2 ON cust_credit_bill ( invnum );
129 CREATE INDEX cust_bill_pay1 ON cust_bill_pay ( invnum );
130 CREATE INDEX cust_bill_pay2 ON cust_bill_pay ( paynum );
131 CREATE INDEX cust_credit_refund1 ON cust_credit_refund ( crednum );
132 CREATE INDEX cust_credit_refund2 ON cust_credit_refund ( refundnum );
133 CREATE UNIQUE INDEX part_svc_column1 ON part_svc_column ( svcpart, columnname );
134 </pre>
135
136   <li>If you are using PostgreSQL, apply the following changes to your database:
137 <pre>
138 CREATE UNIQUE INDEX agent_pkey ON agent ( agentnum );
139 CREATE UNIQUE INDEX agent_type_pkey agent_type ( typenum );
140 CREATE UNIQUE INDEX cust_bill_pkey ON cust_bill ( invnum );
141 CREATE UNIQUE INDEX cust_credit_pkey ON cust_credit ( crednum );
142 CREATE UNIQUE INDEX cust_main_pkey ON cust_main ( custnum );
143 CREATE UNIQUE INDEX cust_main_county_pkey ON cust_main_county ( taxnum );
144 CREATE UNIQUE INDEX cust_main_invoice_pkey ON cust_main_invoice ( destnum );
145 CREATE UNIQUE INDEX cust_pay_pkey ON cust_pay ( paynum );
146 CREATE UNIQUE INDEX cust_pkg_pkey ON cust_pkg ( pkgnum );
147 CREATE UNIQUE INDEX cust_refund_pkey ON cust_refund ( refundnum );
148 CREATE UNIQUE INDEX cust_svc_pkey ON cust_svc ( svcnum );
149 CREATE UNIQUE INDEX domain_record_pkey ON domain_record ( recnum );
150 CREATE UNIQUE INDEX nas_pkey ON nas ( nasnum );
151 CREATE UNIQUE INDEX part_pkg_pkey ON part_pkg ( pkgpart );
152 CREATE UNIQUE INDEX part_referral_pkey ON part_referral ( refnum );
153 CREATE UNIQUE INDEX part_svc_pkey ON part_svc ( svcpart );
154 CREATE UNIQUE INDEX port_pkey ON port ( portnum );
155 CREATE UNIQUE INDEX prepay_credit_pkey ON prepay_credit ( prepaynum );
156 CREATE UNIQUE INDEX session_pkey ON session ( sessionnum );
157 CREATE UNIQUE INDEX svc_acct_pkey ON svc_acct ( svcnum );
158 CREATE UNIQUE INDEX svc_acct_pop_pkey ON svc_acct_pop ( popnum );
159 CREATE UNIQUE INDEX svc_acct_sm_pkey ON svc_acct_sm ( svcnum );
160 CREATE UNIQUE INDEX svc_domain_pkey ON svc_domain ( svcnum );
161 CREATE UNIQUE INDEX svc_www_pkey ON svc_www ( svcnum );
162 CREATE UNIQUE INDEX type_pkgs_pkey ON type_pkgs ( typenum );
163 </pre>
164   <li>If you wish to enable service/shipping addresses, apply the following
165       changes to your database:
166 <pre>
167 ALTER TABLE cust_main ADD COLUMN ship_last varchar(80) NULL;
168 ALTER TABLE cust_main ADD COLUMN ship_first varchar(80) NULL;
169 ALTER TABLE cust_main ADD COLUMN ship_company varchar(80) NULL;
170 ALTER TABLE cust_main ADD COLUMN ship_address1 varchar(80) NULL;
171 ALTER TABLE cust_main ADD COLUMN ship_address2 varchar(80) NULL;
172 ALTER TABLE cust_main ADD COLUMN ship_city varchar(80) NULL;
173 ALTER TABLE cust_main ADD COLUMN ship_county varchar(80) NULL;
174 ALTER TABLE cust_main ADD COLUMN ship_state varchar(80) NULL;
175 ALTER TABLE cust_main ADD COLUMN ship_zip varchar(10) NULL;
176 ALTER TABLE cust_main ADD COLUMN ship_country char(2) NULL;
177 ALTER TABLE cust_main ADD COLUMN ship_daytime varchar(20) NULL;
178 ALTER TABLE cust_main ADD COLUMN ship_night varchar(20) NULL;
179 ALTER TABLE cust_main ADD COLUMN ship_fax varchar(12) NULL;
180 CREATE INDEX cust_main1 ON cust_main ( ship_last );
181 CREATE INDEX cust_main2 ON cust_main ( ship_company );
182 </pre>
183   <li>If you wish to enable customer comments, apply the following change to
184       your database:
185 <pre>
186 ALTER TABLE cust_main ADD COLUMN comments varchar NULL;
187 </pre>
188   <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.
189   <li>Run bin/dbdef-create.
190   <li>create a service based on svc_forward
191   <li>Run bin/fs-migrate-svc_acct_sm
192   <li>Run bin/fs-migrate-payref
193   <li>Run bin/fs-migrate-part_svc
194   <li><b>After running bin/fs-migrate-payref</b>, apply the following changes to your database:
195   <table border><tr><th>PostgreSQL</th><th>MySQL, others</th></tr>
196 <tr><td>
197 <font size=-1><pre>
198 CREATE TABLE cust_pay_temp (
199   paynum int primary key,
200   custnum int not null,
201   paid decimal(10,2) not null,
202   _date int null,
203   payby char(4) not null,
204   payinfo varchar(16) null,
205   paybatch varchar(80) null
206 );
207 INSERT INTO cust_pay_temp SELECT * from cust_pay;
208 DROP TABLE cust_pay;
209 ALTER TABLE cust_pay_temp RENAME TO cust_pay;
210 CREATE UNIQUE INDEX cust_pay1 ON cust_pay paynum;
211 CREATE TABLE cust_refund_temp (
212   refundnum int primary key,
213   custnum int not null,
214   _date int null,
215   refund decimal(10,2) not null,
216   otaker varchar(8) not null,
217   reason varchar(80) not null,
218   payby char(4) not null,
219   payinfo varchar(16) null,
220   paybatch varchar(80) null
221 );
222 INSERT INTO cust_refund_temp SELECT * from cust_refund;
223 DROP TABLE cust_refund;
224 ALTER TABLE cust_refund_temp RENAME TO cust_refund;
225 CREATE UNIQUE INDEX cust_refund1 ON cust_refund refundnum;
226 </pre></font>
227 </td><td>
228 <font size=-1><pre>
229 ALTER TABLE cust_pay DROP COLUMN invnum;
230 ALTER TABLE cust_refund DROP COLUMN crednum;
231 </pre></font>
232 </td></tr></table>
233   <li><b>IMPORTANT: After applying the second set of database changes</b>, run bin/dbdef-create again.
234   <li>create the <a href="config.html#username_policy">user_policy configuration file</a> as appropriate for your site.
235   <li>Create the `/usr/local/etc/freeside/cache.<i>datasrc</i>' directory
236       (ownded by the freeside user).
237   <li>freeside-queued was installed with the Perl modules.  Start it now and ensure that is run upon system startup.
238 </ul>
239 </body>