linking DIDs and users to PBXes, RT#7051
[freeside.git] / FS / FS / Schema.pm
index d275d67..ebfce79 100644 (file)
@@ -256,7 +256,7 @@ sub dbdef_dist {
             } );
     
             if ( $column->type =~ /^(\w*)SERIAL$/i ) {
-              $column->type('int');
+              $column->type(uc($1).'INT');
               $column->null('NULL');
             }
             #$column->default('')
@@ -378,8 +378,9 @@ sub tables_hashref {
         'custnum',   'int', '', '', '', '',
         '_date',     @date_type, '', '',
         'otaker',    'varchar', '', 32, '', '',
-        'filename',  'varchar', '', 32, '', '',
-        'mime_type', 'varchar', '', 32, '', '',
+        'filename',  'varchar', '', 255, '', '',
+        'mime_type', 'varchar', '', $char_d, '', '',
+        'title',     'varchar', 'NULL', $char_d, '', '',
         'body',      'blob', 'NULL', '', '', '',
         'disabled',  @date_type, '', '',
       ],
@@ -572,7 +573,9 @@ sub tables_hashref {
         'amount',  'decimal', 'NULL', '10,4', '', '',
         'format',  'char', 'NULL', 1, '', '',
         'classnum', 'int', 'NULL', '', '', '',
+        'duration', 'int', 'NULL', '',  0, '',
         'phonenum', 'varchar', 'NULL', 15, '', '',
+        'regionname', 'varchar', 'NULL', $char_d, '', '',
         'detail',  'varchar', '', 255, '', '', 
       ],
       'primary_key' => 'detailnum',
@@ -911,6 +914,8 @@ sub tables_hashref {
         'passflag',    'char', 'NULL', 1, '', '',  # Y = required to list as line item, N = Prohibited
         'setuptax',    'char', 'NULL', 1, '', '',  # Y = setup tax exempt
         'recurtax',    'char', 'NULL', 1, '', '',  # Y = recur tax exempt
+        'inoutcity',   'char', 'NULL', 1, '', '',  # '', 'I', or 'O'
+        'inoutlocal',  'char', 'NULL', 1, '', '',  # '', 'I', or 'O'
         'manual',      'char', 'NULL', 1, '', '',  # Y = manually edited
         'disabled',    'char', 'NULL', 1, '', '',  # Y = tax disabled
       ],
@@ -1470,14 +1475,15 @@ sub tables_hashref {
         'downbytes_threshold',   'bigint', 'NULL',   '', '', '',
         'totalbytes','bigint', 'NULL',   '', '', '',
         'totalbytes_threshold',   'bigint', 'NULL',   '', '', '',
-        'domsvc',    'int', '',   '', '', '', 
+        'domsvc',    'int',     '', '', '', '', 
+        'pbxsvc',    'int', 'NULL', '', '', '',
         'last_login',  @date_type, '', '', 
         'last_logout', @date_type, '', '', 
       ],
       'primary_key' => 'svcnum',
       #'unique' => [ [ 'username', 'domsvc' ] ],
       'unique' => [],
-      'index' => [ ['username'], ['domsvc'] ],
+      'index' => [ ['username'], ['domsvc'], ['pbxsvc'] ],
     },
 
     'acct_rt_transaction' => {
@@ -1964,14 +1970,16 @@ sub tables_hashref {
       ],
       'primary_key' => 'prefixnum',
       'unique'      => [],
-      'index'       => [ [ 'countrycode' ], [ 'regionnum' ] ],
+      'index'       => [ [ 'countrycode' ], [ 'npa' ], [ 'regionnum' ] ],
     },
 
     'usage_class' => {
       'columns' => [
-        'classnum',    'serial',   '',      '', '', '', 
-        'classname',   'varchar',  '', $char_d, '', '', 
-        'disabled',    'char', 'NULL',       1, '', '', 
+        'classnum',    'serial',      '',      '', '', '', 
+        'weight',      'int',     'NULL',      '', '', '',
+        'classname',   'varchar',     '', $char_d, '', '', 
+        'format',      'varchar', 'NULL', $char_d, '', '', 
+        'disabled',    'char',    'NULL',       1, '', '', 
       ],
       'primary_key' => 'classnum',
       'unique' => [],
@@ -2084,6 +2092,7 @@ sub tables_hashref {
         'categorynum',   'serial',  '', '', '', '', 
         'categoryname',  'varchar', '', $char_d, '', '', 
         'weight',         'int', 'NULL',  '', '', '',
+        'condense',      'char', 'NULL',   1, '', '', 
         'disabled',      'char', 'NULL',   1, '', '', 
       ],
       'primary_key' => 'categorynum',
@@ -2194,9 +2203,10 @@ sub tables_hashref {
         #an indexed place to put big numbers
         'cdrid',         'bigint',     'NULL',     '',  '', '', 
 
-        #i should become a table
+        #old
         'cdrbatch', 'varchar', 'NULL', 255, '', '',
-        #'cdrbatchnum', 'int', 'NULL', '', '', '',
+        #new
+        'cdrbatchnum', 'int', 'NULL', '', '', '',
 
       ],
       'primary_key' => 'acctid',
@@ -2205,20 +2215,20 @@ sub tables_hashref {
                    [ 'src' ], [ 'dst' ], [ 'dcontext' ], [ 'charged_party' ],
                    [ 'accountcode' ], [ 'carrierid' ], [ 'cdrid' ],
                    [ 'freesidestatus' ], [ 'freesiderewritestatus' ],
-                   [ 'cdrbatch' ],
+                   [ 'cdrbatch' ], [ 'cdrbatchnum' ],
                  ],
     },
 
-    #'cdr_batch' => {
-    #  'columns' => [
-    #    'cdrbatchnum',   'serial',    '',   '', '', '', 
-    #    'cdrbatch', 'varchar', 'NULL', 255, '', '',
-    #    '_date',     @date_type, '', '', 
-    #  ],
-    #  'primary_key' => 'cdrbatchnum',
-    #  'unique' => [ [ 'cdrbatch' ] ],
-    #  'index' => [],
-    #},
+    'cdr_batch' => {
+      'columns' => [
+        'cdrbatchnum',   'serial',    '',   '', '', '', 
+        'cdrbatch', 'varchar', 'NULL', 255, '', '',
+        '_date',     @date_type, '', '', 
+      ],
+      'primary_key' => 'cdrbatchnum',
+      'unique' => [ [ 'cdrbatch' ] ],
+      'index' => [],
+    },
 
     'cdr_termination' => {
       'columns' => [
@@ -2392,10 +2402,11 @@ sub tables_hashref {
         'pin',          'varchar', 'NULL', $char_d, '', '',
         'sip_password', 'varchar', 'NULL', $char_d, '', '',
         'phone_name',   'varchar', 'NULL', $char_d, '', '',
+        'pbxsvc',           'int', 'NULL',      '', '', '',
       ],
       'primary_key' => 'svcnum',
       'unique' => [],
-      'index'  => [ [ 'countrycode', 'phonenum' ] ],
+      'index'  => [ [ 'countrycode', 'phonenum' ], ['pbxsvc'] ],
     },
 
     'phone_device' => {
@@ -2490,6 +2501,20 @@ sub tables_hashref {
       'unique'      => [ [ 'pkgnum', 'refnum' ] ],
       'index'       => [ [ 'pkgnum' ], [ 'refnum' ] ],
     },
+
+    'svc_pbx' => {
+      'columns' => [
+        'svcnum',         'int',     '',      '', '', '', 
+        'id',             'int', 'NULL',      '', '', '', 
+        'title',      'varchar', 'NULL', $char_d, '', '', 
+        'max_extensions', 'int', 'NULL',      '', '', '',
+      ],
+      'primary_key' => 'svcnum',
+      'unique' => [],
+      'index'  => [ [ 'id' ] ],
+    },
+
+
     # name type nullability length default local
 
     #'new_table' => {