install DBD::Pg 1.32 (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)
install DBIx::DBSchema 0.23
install Net::SSH 0.08
-- 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.
+- 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.
+- In httpd.conf, change <Files ~ \.cgi> to <Files ~ (\.cgi|\.html)>
+- In httpd.conf, change <b>AddHandler perl-script .cgi</b> or <b>SetHandler perl-script</b> to <b>AddHandler perl-script .cgi .html</b>
-install NetAddr::IP, Chart::Base, IPC::ShareLite and Locale::SubCountry
+install NetAddr::IP, Chart::Base, Locale::SubCountry,
+JavaScript::RPC (JavaScript::RPC::Server::CGI) <!-- and Crypt::YAPassGen-->
+
+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' );
CREATE TABLE cust_bill_pkg_detail (
detailnum serial,
CREATE TABLE svc_external (
svcnum int NOT NULL,
- id int NOT NULL,
+ id int,
title varchar(80),
PRIMARY KEY (svcnum)
);
ALTER TABLE part_pkg ADD PRIMARY KEY (pkgpart);
select setval('public.part_pkg_temp_pkgpart_seq', ( select max(pkgpart) from part_pkg) );
-Or on Pg versions that don't support DROP CONSTRAINT and ADD PRIMARY KEY (tested on 7.1 so far):
+Or on Pg versions that don't support DROP CONSTRAINT and ADD PRIMARY KEY (tested on 7.1 and 7.2 so far):
DROP INDEX part_pkg_temp_pkey;
CREATE UNIQUE INDEX part_pkg_pkey ON part_pkg (pkgpart);
-select setval('part_pkg_temp_pkgpart_seq', ( select max(pkgpart) from part_pkg) );
+probably this one?: select setval('part_pkg_temp_pkgpart_seq', ( select max(pkgpart) from part_pkg) );
+probably not this one?: select setval('part_pkg_pkgpart_seq', ( select max(pkgpart) from part_pkg) );
CREATE TABLE h_part_pkg_temp (
historynum serial NOT NULL,
ALTER TABLE h_part_pkg ADD PRIMARY KEY (historynum);
select setval('public.h_part_pkg_temp_historynum_seq', ( select max(historynum) from h_part_pkg) );
-Or on Pg versions that don't support DROP CONSTRAINT and ADD PRIMARY KEY (tested on 7.1 so far):
+Or on Pg versions that don't support DROP CONSTRAINT and ADD PRIMARY KEY (tested on 7.1 and 7.2 so far):
DROP INDEX h_part_pkg_temp_pkey;
CREATE UNIQUE INDEX h_part_pkg_pkey ON h_part_pkg (historynum);
-select setval('h_part_pkg_temp_historynum_seq', ( select max(historynum) from h_part_pkg) );
+probably this one?: select setval('h_part_pkg_temp_historynum_seq', ( select max(historynum) from h_part_pkg) );
+probably not this one?: select setval('h_part_pkg_historynum_seq', ( select max(historynum) from h_part_pkg) );
+
+CREATE TABLE cust_pay_refund (
+ payrefundnum serial NOT NULL,
+ paynum int NOT NULL,
+ refundnum int NOT NULL,
+ _date int NOT NULL,
+ amount decimal(10,2) NOT NULL,
+ PRIMARY KEY (payrefundnum)
+);
+CREATE INDEX cust_pay_refund1 ON cust_pay_refund(paynum);
+CREATE INDEX cust_pay_refund2 ON cust_pay_refund(refundnum);
+
+CREATE TABLE cust_pay_void (
+ paynum int NOT NULL,
+ custnum int NOT NULL,
+ paid decimal(10,2) NOT NULL,
+ _date int,
+ payby char(4) NOT NULL,
+ payinfo varchar(80),
+ paybatch varchar(80),
+ closed char(1),
+ void_date int,
+ reason varchar(80),
+ otaker varchar(32) NOT NULL,
+ PRIMARY KEY (paynum)
+);
+CREATE INDEX cust_pay_void1 ON cust_pay_void(custnum);
+
+CREATE TABLE part_pkg_option (
+ optionnum int primary key,
+ pkgpart int not null,
+ optionname varchar(80) not null,
+ optionvalue text NULL
+);
+CREATE INDEX part_pkg_option1 ON part_export_option ( pkgpart );
+CREATE INDEX part_pkg_option2 ON part_export_option ( optionname );
+
+CREATE TABLE rate (
+ ratenum serial NOT NULL,
+ reatename varchar(80) NOT NULL,
+ PRIMARY KEY (ratenum)
+);
+
+CREATE TABLE rate_detail (
+ ratenum int NOT NULL,
+ orig_regionnum int NULL,
+ dest_regionnum int NOT NULL,
+ min_included int NOT NULL,
+ min_charge decimal(10,2) NOT NULL,
+ sec_granularity int NOT NULL
+);
+CREATE UNIQUE INDEX rate_detail1 ON rate_detail ( ratenum, orig_regionnum, dest_regionnum );
+CREATE TABLE rate_region (
+ regionnum serial NOT NULL,
+ regionname varchar(80) NOT NULL,
+ PRIMARY KEY (regionnum)
+);
+
+CREATE TABLE rate_prefix (
+ prefixnum serial NOT NULL,
+ regionnum int NOT NULL,
+ countrycode varchar(3) NOT NULL,
+ npa varchar(6) NULL,
+ nxx varchar(3) NULL,
+ PRIMARY KEY (prefixnum)
+);
+CREATE INDEX rate_prefix1 ON rate_prefix ( countrycode );
+CREATE INDEX rate_prefix2 ON rate_prefix ( regionnum );
+
+CREATE TABLE reg_code (
+ codenum serial NOT NULL,
+ code varchar(80) NOT NULL,
+ agentnum int NOT NULL,
+ PRIMARY KEY (codenum)
+);
+CREATE UNIQUE INDEX reg_code1 ON reg_code ( agentnum, code );
+CREATE INDEX reg_code2 ON reg_code ( agentnum );
+
+CREATE TABLE reg_code_pkg (
+ codenum int NOT NULL,
+ pkgpart int NOT NULL
+);
+CREATE UNIQUE INDEX reg_code_pkg1 ON reg_code_pkg ( codenum, pkgpart );
+CREATE INDEX reg_code_pkg2 ON reg_code_pkg ( codenum );
+
+CREATE TABLE clientapi_session (
+ sessionnum serial NOT NULL,
+ sessionid varchar(80) NOT NULL,
+ namespace varchar(80) NOT NULL,
+ PRIMARY KEY (sessionnum)
+);
+CREATE UNIQUE INDEX clientapi_session1 ON clientapi_session ( sessionid, namespace );
+
+CREATE TABLE clientapi_session_field (
+ fieldnum serial NOT NULL,
+ sessionnum int NOT NULL,
+ fieldname varchar(80) NOT NULL,
+ fieldvalue text NULL,
+ PRIMARY KEY (fieldnum)
+);
+CREATE UNIQUE INDEX clientapi_session_field1 ON clientapi_session_field ( sessionnum, fieldname );
DROP INDEX cust_bill_pkg1;
ALTER TABLE h_pkg_svc ADD primary_svc char(1) NULL;
ALTER TABLE svc_forward ADD src varchar(255) NULL;
ALTER TABLE h_svc_forward ADD src varchar(255) NULL;
+ALTER TABLE part_pkg ADD promo_code varchar(80) NULL;
+ALTER TABLE h_part_pkg ADD promo_code varchar(80) NULL;
+CREATE INDEX part_pkg2 ON part_pkg ( promo_code );
+CREATE INDEX h_part_pkg2 ON h_part_pkg ( promo_code );
On recent Pg versions:
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;
Or on Pg versions that don't support DROP NOT NULL (tested on 7.1 and 7.2 so far):
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' ) );
If you created your database with a version before 1.4.2, dump database, edit:
- cust_main and h_cust_main: increase otaker from 8 to 32
-- cust_main and h_cust_main: change ss from char(11) to varchar(11)
+- cust_main and h_cust_main: change ss from char(11) to varchar(11) ( "character(11)" to "character varying(11)" )
- cust_credit and h_cust_credit: increase otaker from 8 to 32
- cust_pkg and h_cust_pkg: increase otaker from 8 to 32
- cust_refund and h_cust_refund: increase otaker from 8 to 32
- domain_record and h_domain_record: increase reczone from 80 to 255
-- domain_record and h_domain_record: change rectype from char to varchar
+- domain_record and h_domain_record: change rectype from char to varchar ( "character(5)" to "character varying(5)" )
- domain_record and h_domain_record: increase recdata from 80 to 255
then reload
mandatory again:
dbdef-create username
-create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband acct_snarf svc_external
+create-history-tables username cust_bill_pkg_detail router part_svc_router addr_block svc_broadband acct_snarf svc_external cust_pay_refund cust_pay_void part_pkg_option rate rate_detail rate_region rate_prefix reg_code reg_code_pkg
dbdef-create username
apache - fix <Files> sections to include .html also