X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FSchema.pm;h=9016676c344b4c6985469ed19497df599bd0def7;hb=3402ff329fde97d6ac96723b5c2a4ed46ed2ce25;hp=80aed8297f11592db1f37e5a3812454c0bcb645f;hpb=9f64bfef652922b7b546a12290805710acbeed08;p=freeside.git diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 80aed8297..9016676c3 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -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('') @@ -372,18 +372,57 @@ sub tables_hashref { 'index' => [ ['typenum'] ], }, + 'cust_attachment' => { + 'columns' => [ + 'attachnum', 'serial', '', '', '', '', + 'custnum', 'int', '', '', '', '', + '_date', @date_type, '', '', + 'otaker', 'varchar', '', 32, '', '', + 'filename', 'varchar', '', 255, '', '', + 'mime_type', 'varchar', '', $char_d, '', '', + 'title', 'varchar', 'NULL', $char_d, '', '', + 'body', 'blob', 'NULL', '', '', '', + 'disabled', @date_type, '', '', + ], + 'primary_key' => 'attachnum', + 'unique' => [], + 'index' => [ ['custnum'] ], + }, + 'cust_bill' => { 'columns' => [ - 'invnum', 'serial', '', '', '', '', - 'custnum', 'int', '', '', '', '', - '_date', @date_type, '', '', - 'charged', @money_type, '', '', - 'printed', 'int', '', '', '', '', - 'closed', 'char', 'NULL', 1, '', '', + #regular fields + 'invnum', 'serial', '', '', '', '', + 'custnum', 'int', '', '', '', '', + '_date', @date_type, '', '', + 'charged', @money_type, '', '', + 'invoice_terms', 'varchar', 'NULL', $char_d, '', '', + + #customer balance info at invoice generation time + 'previous_balance', @money_typen, '', '', #eventually not nullable + 'billing_balance', @money_typen, '', '', #eventually not nullable + + #deprecated (unused by now, right?) + 'printed', 'int', '', '', '', '', + + #specific use cases + 'closed', 'char', 'NULL', 1, '', '', + 'statementnum', 'int', 'NULL', '', '', '', #invoice aggregate statements ], 'primary_key' => 'invnum', 'unique' => [], - 'index' => [ ['custnum'], ['_date'] ], + 'index' => [ ['custnum'], ['_date'], ['statementnum'], ], + }, + + 'cust_statement' => { + 'columns' => [ + 'statementnum', 'serial', '', '', '', '', + 'custnum', 'int', '', '', '', '', + '_date', @date_type, '', '', + ], + 'primary_key' => 'statementnum', + 'unique' => [], + 'index' => [ ['custnum'], ['_date'], ], }, 'cust_bill_event' => { @@ -531,9 +570,12 @@ sub tables_hashref { 'billpkgnum', 'int', 'NULL', '', '', '', # should not be nullable 'pkgnum', 'int', 'NULL', '', '', '', # deprecated 'invnum', 'int', 'NULL', '', '', '', # deprecated - 'amount', @money_typen, '', '', + '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', @@ -872,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 ], @@ -1412,7 +1456,7 @@ sub tables_hashref { 'columns' => [ 'svcnum', 'int', '', '', '', '', 'username', 'varchar', '', $username_len, '', '', - '_password', 'varchar', '', 512, '', '', + '_password', 'varchar', 'NULL', 512, '', '', '_password_encoding', 'varchar', 'NULL', $char_d, '', '', 'sec_phrase', 'varchar', 'NULL', $char_d, '', '', 'popnum', 'int', 'NULL', '', '', '', @@ -1431,14 +1475,26 @@ 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, '', '', + #communigate pro fields (quota = MaxAccountSize) + 'file_quota', 'varchar', 'NULL', $char_d, '', '', #MaxWebSize + 'file_maxnum', 'varchar', 'NULL', $char_d, '', '', #MaxWebFiles + 'file_maxsize', 'varchar', 'NULL', $char_d, '', '', #MaxFileSize + 'cgp_accessmodes', 'varchar', 'NULL', 255, '', '', #AccessModes + 'password_selfchange','char', 'NULL', 1, '', '', #PWDAllowed + 'password_recover', 'char', 'NULL', 1, '', '', #PasswordRecovery + 'cgp_type', 'varchar', 'NULL', $char_d, '', '', #AccountType + 'cgp_aliases', 'varchar', 'NULL', 255, '', '', + 'cgp_deletemode', 'varchar', 'NULL', $char_d, '', '', #DeleteMode + 'cgp_emptytrash', 'varchar', 'NULL', $char_d, '', '', #EmptyTrash ], 'primary_key' => 'svcnum', #'unique' => [ [ 'username', 'domsvc' ] ], 'unique' => [], - 'index' => [ ['username'], ['domsvc'] ], + 'index' => [ ['username'], ['domsvc'], ['pbxsvc'] ], }, 'acct_rt_transaction' => { @@ -1474,9 +1530,22 @@ sub tables_hashref { 'parent_svcnum', 'int', 'NULL', '', '', '', 'registrarnum', 'int', 'NULL', '', '', '', 'registrarkey', 'varchar', 'NULL', 512, '', '', - 'setup_date', @date_type, '', '', + 'setup_date', @date_type, '', '', 'renewal_interval', 'int', 'NULL', '', '', '', 'expiration_date', @date_type, '', '', + #communigate pro fields (quota = MaxAccountSize) + 'max_accounts', 'int', 'NULL', '', '', '', + 'cgp_aliases', 'varchar', 'NULL', 255, '', '', + 'cgp_accessmodes','varchar','NULL', 255, '', '', #DomainAccessModes + 'acct_def_password_selfchange','char', 'NULL', 1, '', '', + 'acct_def_password_recover', 'char', 'NULL', 1, '', '', + 'acct_def_cgp_accessmodes', 'varchar', 'NULL', 255, '', '', + 'acct_def_quota', 'varchar', 'NULL', $char_d, '', '', + 'acct_def_file_quota', 'varchar', 'NULL', $char_d, '', '', + 'acct_def_file_maxnum', 'varchar', 'NULL', $char_d, '', '', + 'acct_def_file_maxsize', 'varchar', 'NULL', $char_d, '', '', + 'acct_def_cgp_deletemode', 'varchar', 'NULL', $char_d, '', '', + 'acct_def_cgp_emptytrash', 'varchar', 'NULL', $char_d, '', '', ], 'primary_key' => 'svcnum', 'unique' => [ ], @@ -1602,7 +1671,7 @@ sub tables_hashref { 'queue' => { 'columns' => [ 'jobnum', 'serial', '', '', '', '', - 'job', 'text', '', '', '', '', + 'job', 'varchar', '', 512, '', '', '_date', 'int', '', '', '', '', 'status', 'varchar', '', $char_d, '', '', 'statustext', 'text', 'NULL', '', '', '', @@ -1652,6 +1721,17 @@ sub tables_hashref { 'index' => [ [ 'exportnum' ], [ 'svcpart' ] ], }, + 'export_device' => { + 'columns' => [ + 'exportdevicenum' => 'serial', '', '', '', '', + 'exportnum' => 'int', '', '', '', '', + 'devicepart' => 'int', '', '', '', '', + ], + 'primary_key' => 'exportdevicenum', + 'unique' => [ [ 'exportnum', 'devicepart' ] ], + 'index' => [ [ 'exportnum' ], [ 'devicepart' ] ], + }, + 'part_export' => { 'columns' => [ 'exportnum', 'serial', '', '', '', '', @@ -1925,14 +2005,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' => [], @@ -2044,6 +2126,8 @@ sub tables_hashref { 'columns' => [ 'categorynum', 'serial', '', '', '', '', 'categoryname', 'varchar', '', $char_d, '', '', + 'weight', 'int', 'NULL', '', '', '', + 'condense', 'char', 'NULL', 1, '', '', 'disabled', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'categorynum', @@ -2107,6 +2191,8 @@ sub tables_hashref { ### # fields for unitel/RSLCOM/convergent that don't map well to asterisk # defaults + # though these are now used elsewhere: + # charged_party, upstream_price, rated_price, carrierid ### #cdr_type: Usage = 1, S&E = 7, OC&C = 8 @@ -2149,19 +2235,36 @@ sub tables_hashref { #NULL, done (or something) 'freesiderewritestatus', 'varchar', 'NULL', 32, '', '', + #an indexed place to put big numbers + 'cdrid', 'bigint', 'NULL', '', '', '', + + #old 'cdrbatch', 'varchar', 'NULL', 255, '', '', + #new + 'cdrbatchnum', 'int', 'NULL', '', '', '', ], 'primary_key' => 'acctid', 'unique' => [], 'index' => [ [ 'calldate' ], [ 'src' ], [ 'dst' ], [ 'dcontext' ], [ 'charged_party' ], - [ 'accountcode' ], [ 'carrierid' ], + [ '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_termination' => { 'columns' => [ 'cdrtermnum', 'bigserial', '', '', '', '', @@ -2334,10 +2437,12 @@ sub tables_hashref { 'pin', 'varchar', 'NULL', $char_d, '', '', 'sip_password', 'varchar', 'NULL', $char_d, '', '', 'phone_name', 'varchar', 'NULL', $char_d, '', '', + 'pbxsvc', 'int', 'NULL', '', '', '', + 'domsvc', 'int', 'NULL', '', '', '', ], 'primary_key' => 'svcnum', 'unique' => [], - 'index' => [ [ 'countrycode', 'phonenum' ] ], + 'index' => [ [ 'countrycode', 'phonenum' ], ['pbxsvc'], ['domsvc'] ], }, 'phone_device' => { @@ -2432,6 +2537,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' => {