tyops
[freeside.git] / bin / fs-setup
index 8fbc67e..3d56d9f 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.46 2001-09-01 21:52:20 jeff Exp $
+# $Id: fs-setup,v 1.51 2001-09-04 11:14:13 ivan Exp $
 
 #to delay loading dbdef until we're ready
 BEGIN { $FS::Record::setup_hack = 1; }
@@ -79,6 +79,8 @@ my(%tables)=&tables_hash_hack;
 #turn it into objects
 my($dbdef) = new DBIx::DBSchema ( map {  
   my(@columns);
+  warn $_;
+  warn $tables{$_}{'columns'};
   while (@{$tables{$_}{'columns'}}) {
     my($name,$type,$null,$length)=splice @{$tables{$_}{'columns'}}, 0, 4;
     push @columns, new DBIx::DBSchema::Column ( $name,$type,$null,$length );
@@ -319,14 +321,15 @@ sub tables_hash_hack {
 
     'cust_credit_bill' => {
       'columns' => [
+        'creditbillnum', 'int', '', '',
         'crednum',  'int', '', '',
         'invnum',  'int', '', '',
         '_date',    @date_type,
         'amount',   @money_type,
       ],
-      'primary_key' => 'crednum',
+      'primary_key' => 'creditbillnum',
       'unique' => [ [] ],
-      'index' => [ ['invnum'] ],
+      'index' => [ ['crednum'], ['invnum'] ],
     },
 
     'cust_main' => {
@@ -411,6 +414,7 @@ sub tables_hash_hack {
       'columns' => [
         'paynum',   'int',    '',   '',
         #now cust_bill_pay #'invnum',   'int',    '',   '',
+        'custnum',  'int',    '',   '',
         'paid',     @money_type,
         '_date',    @date_type,
         'payby',    'char',   '',     4, # CARD/BILL/COMP, should be index into
@@ -420,18 +424,18 @@ sub tables_hash_hack {
       ],
       'primary_key' => 'paynum',
       'unique' => [ [] ],
-      'index' => [ ['invnum'] ],
+      'index' => [ [] ],
     },
 
     'cust_bill_pay' => {
-      'column' => [
+      'columns' => [
         'billpaynum', 'int',     '',   '',
         'invnum',  'int',     '',   '',
         'paynum',  'int',     '',   '',
         'amount',  @money_type,
         '_date',   @date_type
       ],
-      'primary_key' => 'billpaynum'
+      'primary_key' => 'billpaynum',
       'unique' => [ [] ],
       'index' => [ [ 'paynum', 'invnum' ] ],
     },
@@ -482,6 +486,7 @@ sub tables_hash_hack {
       'columns' => [
         'refundnum',    'int',    '',   '',
         #now cust_credit_refund #'crednum',      'int',    '',   '',
+        'custnum',  'int',    '',   '',
         '_date',        @date_type,
         'refund',       @money_type,
         'otaker',       'varchar',   '',   8,
@@ -493,18 +498,18 @@ sub tables_hash_hack {
       ],
       'primary_key' => 'refundnum',
       'unique' => [ [] ],
-      'index' => [ ['crednum'] ],
+      'index' => [ [] ],
     },
 
     'cust_credit_refund' => {
-      'column' => [
+      'columns' => [
         'creditrefundnum', 'int',     '',   '',
         'crednum',  'int',     '',   '',
         'refundnum',  'int',     '',   '',
         'amount',  @money_type,
         '_date',   @date_type
       ],
-      'primary_key' => 'creditrefundnum'
+      'primary_key' => 'creditrefundnum',
       'unique' => [ [] ],
       'index' => [ [ 'crednum', 'refundnum' ] ],
     },