indices on cust_main ship_last and ship_country
authorivan <ivan>
Sun, 19 Aug 2001 13:50:47 +0000 (13:50 +0000)
committerivan <ivan>
Sun, 19 Aug 2001 13:50:47 +0000 (13:50 +0000)
bin/fs-setup
httemplate/docs/upgrade8.html

index ec8b750..7056347 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.42 2001-08-13 00:19:02 ivan Exp $
+# $Id: fs-setup,v 1.43 2001-08-19 13:50:47 ivan Exp $
 
 #to delay loading dbdef until we're ready
 BEGIN { $FS::Record::setup_hack = 1; }
@@ -92,10 +92,11 @@ my($dbdef) = new DBIx::DBSchema ( map {
   );
 } (keys %tables) );
 
-#remove ship_ from cust_main
-unless ($ship) {
-  my $cust_main = $dbdef->table('cust_main');
+my $cust_main = $dbdef->table('cust_main');
+unless ($ship) { #remove ship_ from cust_main
   $cust_main->delcolumn($_) foreach ( grep /^ship_/, $cust_main->columns );
+} else { #add indices on ship_last and ship_company
+  push @{$cust_main->index->lol_ref}, ( ['ship_last'], ['ship_company'] ) 
 }
 
 #add radius attributes to svc_acct
@@ -363,7 +364,7 @@ sub tables_hash_hack {
       'primary_key' => 'custnum',
       'unique' => [ [] ],
       #'index' => [ ['last'], ['company'] ],
-      'index' => [ ['last'], ],
+      'index' => [ ['last'], [ 'company' ] ],
     },
 
     'cust_main_invoice' => {
index 1a5c998..60f8f15 100644 (file)
@@ -129,6 +129,8 @@ ALTER TABLE cust_main ADD COLUMN ship_country char(2) NULL;
 ALTER TABLE cust_main ADD COLUMN ship_daytime varchar(20) NULL;
 ALTER TABLE cust_main ADD COLUMN ship_night varchar(20) NULL;
 ALTER TABLE cust_main ADD COLUMN ship_fax varchar(12) NULL;
+CREATE INDEX cust_main1 ON cust_main ( ship_last );
+CREATE INDEX cust_main2 ON cust_main ( ship_company );
 </pre>
   <li>If you wish to enable customer comments, apply the following change to
       your database: