package start_on_hold flag, and better behavior for automatic timers + packages on...
[freeside.git] / FS / FS / Schema.pm
index 64e3f1c..04e5dd4 100644 (file)
@@ -243,6 +243,23 @@ sub dbdef_dist {
                         ],
          });
 
+       #necessary for queries that want to look at *who* made changes
+      $h_indices{"h_${table}_usernum"} =
+         DBIx::DBSchema::Index->new({
+           'name'    => "h_${table}_usernum",
+           'unique'  => 0,
+           'columns' => [ 'history_usernum'],
+         });
+
+       # necessary because of the evil OR username for older data, be really nice if everything was just migrated to usernum and we could drop username
+       # This will not be helpful to mysql, but postgres smartly does a bitmap across both indexes, mysql will just use one
+
+      $h_indices{"h_${table}_user"} =
+         DBIx::DBSchema::Index->new({
+           'name'    => "h_${table}_user",
+           'unique'  => 0,
+           'columns' => [ 'history_user'],
+         });
     }
 
     my $primary_key_col = $tableobj->column($tableobj->primary_key)
@@ -1794,10 +1811,11 @@ sub tables_hashref {
         'add_date',   @date_type,                  '', '', 
         'disabled',       'char', 'NULL',       1, '', '', 
         'custnum',         'int', 'NULL',      '', '', '',
+        'refnum',          'int', 'NULL',      '', '', '', 
       ],
       'primary_key'  => 'prospectnum',
       'unique'       => [],
-      'index'        => [ [ 'company' ], [ 'agentnum' ], [ 'disabled' ] ],
+      'index'        => [ ['company'], ['agentnum'], ['disabled'], ['refnum'] ],
       'foreign_keys' => [
                           { columns    => [ 'agentnum' ],
                             table      => 'agent',
@@ -1805,6 +1823,9 @@ sub tables_hashref {
                           { columns    => [ 'custnum' ],
                             table      => 'cust_main',
                           },
+                          { columns    => [ 'refnum' ],
+                            table      => 'part_referral',
+                          },
                         ],
     },
 
@@ -3031,6 +3052,7 @@ sub tables_hashref {
         'successor',     'int',     'NULL', '', '', '',
         'family_pkgpart','int',     'NULL', '', '', '',
         'delay_start',   'int',     'NULL', '', '', '',
+        'start_on_hold', 'char',    'NULL',  1, '', '',
         'agent_pkgpartid', 'varchar', 'NULL', 20, '', '',
       ],
       'primary_key'  => 'pkgpart',
@@ -6248,7 +6270,7 @@ sub tables_hashref {
       'columns' => [
         'logcontextnum', 'serial', '', '', '', '',
         'lognum', 'int', '', '', '', '',
-        'context', 'varchar', '', 32, '', '',
+        'context', 'varchar', '', $char_d, '', '',
       ],
       'primary_key'  => 'logcontextnum',
       'unique'       => [ [ 'lognum', 'context' ] ],
@@ -6352,7 +6374,7 @@ sub tables_hashref {
         'mac_addr',  'varchar', 'NULL',      12, '', '', 
       ],
       'primary_key'  => 'svcnum',
-      'unique'       => [],
+      'unique'       => [ ['serialnum'] , ['mac_addr'] ],
       'index'        => [],
       'foreign_keys' => [
                           { columns    => [ 'svcnum' ],