X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FSchema.pm;h=0793af457f202955ecebc861d22f1566eb618d5a;hb=b3db3e68f602f3ca395a6bc272a4de6fef2d0895;hp=de8a7c076d6648fd02bfb025fb3e52fa1522694d;hpb=de89844a6491378da978014c844213ad3c3a118e;p=freeside.git diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index de8a7c076..0793af457 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -189,13 +189,15 @@ sub dbdef_dist { my $tables_hashref_torrus = tables_hashref_torrus(); - #create history tables (false laziness w/create-history-tables) + #create history tables foreach my $table ( - grep { ! /^clientapi_session/ + grep { ! /^(clientapi|access_user)_session/ && ! /^h_/ && ! /^log(_context)?$/ - && ( ! /^queue(_arg)?$/ || ! $opt->{'queue-no_history'} ) + && ! /^legacy_cust_history$/ + && ( ! /^queue(_arg|_depend|_stat)?$/ || ! $opt->{'queue-no_history'} ) && ! $tables_hashref_torrus->{$_} + && ! /^cacti_page$/ } $dbdef->tables ) { @@ -636,6 +638,22 @@ sub tables_hashref { 'index' => [ ['legacyid', 'custnum', 'locale' ], ], }, + 'legacy_cust_history' => { + 'columns' => [ + 'legacyhistorynum', 'serial', '', '', '', '', + 'custnum', 'int', '', '', '', '', + 'history_action', 'varchar', '', $char_d, '', '', + 'history_date', @date_type, '', '', + 'history_usernum', 'int', 'NULL', '', '', '', + 'item', 'varchar', 'NULL', $char_d, '', '', + 'description', 'varchar', 'NULL', 2*$char_d, '', '', + 'change_data', 'text', 'NULL', '', '', '', + ], + 'primary_key' => 'legacyhistorynum', + 'unique' => [], + 'index' => [ ['custnum'], ['history_date'], ], + }, + 'cust_statement' => { 'columns' => [ 'statementnum', 'serial', '', '', '', '', @@ -854,6 +872,23 @@ sub tables_hashref { ], }, + 'cust_bill_pkg_fee_void' => { + 'columns' => [ + 'billpkgfeenum', 'serial', '', '', '', '', + 'billpkgnum', 'int', '', '', '', '', + 'base_invnum', 'int', '', '', '', '', + 'base_billpkgnum', 'int', 'NULL', '', '', '', + 'amount', @money_type, '', '', + ], + 'primary_key' => 'billpkgfeenum', + 'unique' => [], + 'index' => [ ['billpkgnum'], + ['base_invnum'], + ['base_billpkgnum'], + ], + }, + + 'cust_bill_pkg_tax_location' => { 'columns' => [ 'billpkgtaxlocationnum', 'serial', '', '', '', '', @@ -911,6 +946,7 @@ sub tables_hashref { 'unitsetup', @money_typen, '', '', 'unitrecur', @money_typen, '', '', 'hidden', 'char', 'NULL', 1, '', '', + 'feepart', 'int', 'NULL', '', '', '', #void fields 'void_date', @date_type, '', '', 'reason', 'varchar', 'NULL', $char_d, '', '', @@ -1180,6 +1216,7 @@ sub tables_hashref { 'message_noemail', 'char', 'NULL', 1, '', '', 'bill_locationnum', 'int', 'NULL', '', '', '', 'ship_locationnum', 'int', 'NULL', '', '', '', + 'invoice_ship_address', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'custnum', 'unique' => [ [ 'agentnum', 'agent_custid' ] ], @@ -1346,6 +1383,24 @@ sub tables_hashref { 'index' => [ ['pkgpart'], ], }, + 'quotation_pkg_detail' => { + 'columns' => [ + 'detailnum', 'serial', '', '', '', '', + 'quotationpkgnum', 'int', '', '', '', '', + 'format', 'char', 'NULL', 1, '', '', # not used for anything + 'detail', 'varchar', '', 255, '', '', + ], + 'primary_key' => 'detailnum', + 'unique' => [], + 'index' => [ [ 'quotationpkgnum' ] ], + 'foreign_keys' => [ + { columns => [ 'quotationpkgnum' ], + table => 'quotation_pkg', + references => [ 'quotationpkgnum' ], + }, + ], + }, + 'quotation_pkg_discount' => { 'columns' => [ 'quotationpkgdiscountnum', 'serial', '', '', '', '', @@ -1360,6 +1415,21 @@ sub tables_hashref { 'index' => [ [ 'quotationpkgnum' ], ], #[ 'discountnum' ] ], }, + 'quotation_pkg_tax' => { + 'columns' => [ + 'quotationtaxnum', 'serial', '', '', '', '', + 'quotationpkgnum', 'int', '', '', '', '', + 'itemdesc', 'varchar', '', $char_d, '', '', + 'taxnum', 'int', '', '', '', '', + 'taxtype', 'varchar', '', $char_d, '', '', + 'setup_amount', @money_type, '', '', + 'recur_amount', @money_type, '', '', + ], + 'primary_key' => 'quotationtaxnum',, + 'unique' => [], + 'index' => [ [ 'quotationpkgnum' ] ], + }, + 'cust_location' => { #'location' now that its prospects too, but... 'columns' => [ 'locationnum', 'serial', '', '', '', '', @@ -1368,7 +1438,7 @@ sub tables_hashref { 'locationname', 'varchar', 'NULL', $char_d, '', '', 'address1', 'varchar', '', $char_d, '', '', 'address2', 'varchar', 'NULL', $char_d, '', '', - 'city', 'varchar', '', $char_d, '', '', + 'city', 'varchar', 'NULL', $char_d, '', '', 'county', 'varchar', 'NULL', $char_d, '', '', 'state', 'varchar', 'NULL', $char_d, '', '', 'zip', 'varchar', 'NULL', 10, '', '', @@ -1687,6 +1757,7 @@ sub tables_hashref { 'payunique', 'varchar', 'NULL', $char_d, '', '', #separate paybatch "unique" functions from current usage 'closed', 'char', 'NULL', 1, '', '', 'pkgnum', 'int', 'NULL', '', '', '', #desired pkgnum for pkg-balances + 'no_auto_apply', 'char', 'NULL', 1, '', '', # cash/check deposit info fields 'bank', 'varchar', 'NULL', $char_d, '', '', 'depositor', 'varchar', 'NULL', $char_d, '', '', @@ -1799,6 +1870,7 @@ sub tables_hashref { 'download', @date_type, '', '', 'upload', @date_type, '', '', 'title', 'varchar', 'NULL',255, '', '', + 'processor_id', 'varchar', 'NULL',255, '', '', ], 'primary_key' => 'batchnum', 'unique' => [], @@ -1815,7 +1887,7 @@ sub tables_hashref { 'first', 'varchar', '', $char_d, '', '', 'address1', 'varchar', '', $char_d, '', '', 'address2', 'varchar', 'NULL', $char_d, '', '', - 'city', 'varchar', '', $char_d, '', '', + 'city', 'varchar', 'NULL', $char_d, '', '', 'state', 'varchar', 'NULL', $char_d, '', '', 'zip', 'varchar', 'NULL', 10, '', '', 'country', 'char', '', 2, '', '', @@ -1919,11 +1991,11 @@ sub tables_hashref { 'cust_pkg_detail' => { 'columns' => [ - 'pkgdetailnum', 'serial', '', '', '', '', - 'pkgnum', 'int', '', '', '', '', - 'detail', 'varchar', '', $char_d, '', '', - 'detailtype', 'char', '', 1, '', '', # "I"nvoice or "C"omment - 'weight', 'int', '', '', '', '', + 'pkgdetailnum', 'serial', '', '', '', '', + 'pkgnum', 'int', '', '', '', '', + 'detail', 'varchar', '', 2*$char_d, '', '', + 'detailtype', 'char', '', 1, '', '', #"I"nvoice or "C"omment + 'weight', 'int', '', '', '', '', ], 'primary_key' => 'pkgdetailnum', 'unique' => [], @@ -1945,6 +2017,19 @@ sub tables_hashref { 'index' => [ [ 'pkgnum' ], [ 'reasonnum' ], ['action'], [ 'usernum' ], ], }, + 'cust_pkg_reason_fee' => { + 'columns' => [ + 'pkgreasonfeenum', 'serial', '', '', '', '', + 'pkgreasonnum', 'int', '', '', '', '', + 'billpkgnum', 'int', 'NULL', '', '', '', + 'feepart', 'int', '', '', '', '', + 'nextbill', 'char', 'NULL', 1, '', '', + ], + 'primary_key' => 'pkgreasonfeenum', + 'unique' => [ [ 'billpkgnum' ], [ 'pkgreasonnum' ] ], # one-to-one link + 'index' => [ [ 'feepart' ] ], + }, + 'cust_pkg_discount' => { 'columns' => [ 'pkgdiscountnum', 'serial', '', '', '', '', @@ -2049,7 +2134,8 @@ sub tables_hashref { 'refund', @money_type, '', '', 'otaker', 'varchar', 'NULL', 32, '', '', 'usernum', 'int', 'NULL', '', '', '', - 'reason', 'varchar', '', $char_d, '', '', + 'reason', 'varchar', 'NULL', $char_d, '', '', + 'reasonnum', 'int', 'NULL', '', '', '', 'payby', 'char', '', 4, '', '', # CARD/BILL/COMP, should # be index into payby # table eventually @@ -2338,6 +2424,7 @@ sub tables_hashref { 'quantity', 'int', '', '', '', '', 'primary_svc','char', 'NULL', 1, '', '', 'hidden', 'char', 'NULL', 1, '', '', + 'provision_hold', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'pkgsvcnum', 'unique' => [ ['pkgpart', 'svcpart'] ], @@ -2381,6 +2468,7 @@ sub tables_hashref { 'columnlabel', 'varchar', 'NULL', $char_d, '', '', 'columnvalue', 'varchar', 'NULL', 512, '', '', 'columnflag', 'char', 'NULL', 1, '', '', + 'required', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'columnnum', 'unique' => [ [ 'svcpart', 'columnname' ] ], @@ -2893,6 +2981,7 @@ sub tables_hashref { 'custnum', 'int', 'NULL', '', '', '', 'secure', 'char', 'NULL', 1, '', '', 'priority', 'int', 'NULL', '', '', '', + 'usernum', 'int', 'NULL', '', '', '', ], 'primary_key' => 'jobnum', 'unique' => [], @@ -3876,6 +3965,19 @@ sub tables_hashref { 'index' => [], }, + 'access_user_session' => { + 'columns' => [ + 'sessionnum', 'serial', '', '', '', '', + 'sessionkey', 'varchar', '', $char_d, '', '', + 'usernum', 'int', '', '', '', '', + 'start_date', @date_type, '', '', + 'last_date', @date_type, '', '', + ], + 'primary_key' => 'sessionnum', + 'unique' => [ [ 'sessionkey' ] ], + 'index' => [], + }, + 'access_user' => { 'columns' => [ 'usernum', 'serial', '', '', '', '', @@ -3949,6 +4051,18 @@ sub tables_hashref { 'index' => [], }, + 'access_user_log' => { + 'columns' => [ + 'lognum', 'serial', '', '', '', '', + 'usernum', 'int', '', '', '', '', + 'path', 'varchar', '', 2*$char_d, '', '', + '_date', @date_type, '', '', + ], + 'primary_key' => 'lognum', + 'unique' => [], + 'index' => [ ['usernum'], ['path'], ['_date'] ], + }, + 'sched_item' => { 'columns' => [ 'itemnum', 'serial', '', '', '', '', @@ -3959,11 +4073,6 @@ sub tables_hashref { 'primary_key' => 'itemnum', 'unique' => [ [ 'usernum' ] ], 'index' => [], - 'foreign_keys' => [ - { columns => [ 'usernum' ], - table => 'access_user', - }, - ], }, #'sched_item_class' @@ -3980,11 +4089,6 @@ sub tables_hashref { 'primary_key' => 'availnum', 'unique' => [], 'index' => [], - 'foreign_keys' => [ - { columns => [ 'itemnum' ], - table => 'sched_item', - }, - ], }, 'svc_phone' => { @@ -4041,6 +4145,7 @@ sub tables_hashref { 'devicepart', 'serial', '', '', '', '', 'devicename', 'varchar', '', $char_d, '', '', 'inventory_classnum', 'int', 'NULL', '', '', '', + 'title', 'varchar', 'NULL', $char_d, '', '', ], 'primary_key' => 'devicepart', 'unique' => [ [ 'devicename' ] ], #? @@ -4169,6 +4274,9 @@ sub tables_hashref { 'unsuspend_pkgpart', 'int', 'NULL', '', '', '', 'unsuspend_hold','char', 'NULL', 1, '', '', 'unused_credit', 'char', 'NULL', 1, '', '', + 'feepart', 'int', 'NULL', '', '', '', + 'fee_on_unsuspend','char', 'NULL', 1, '', '', + 'fee_hold', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'reasonnum', 'unique' => [], @@ -4226,15 +4334,6 @@ sub tables_hashref { 'primary_key' => 'extensionnum', 'unique' => [ [ 'svcnum', 'extension' ] ], 'index' => [ [ 'svcnum' ] ], - 'foreign_keys' => [ - { columns => [ 'svcnum' ], - table => 'svc_pbx', - }, - { columns => [ 'circuit_svcnum' ], - table => 'svc_circuit', - references => [ 'svcnum' ], - }, - ], }, 'svc_mailinglist' => { #svc_group? @@ -4607,20 +4706,6 @@ sub tables_hashref { 'primary_key' => 'svcnum', 'unique' => [], 'index' => [ [ 'providernum' ], [ 'typenum' ] ], - 'foreign_keys' => [ - { columns => [ 'svcnum' ], - table => 'cust_svc', - }, - { columns => [ 'typenum' ], - table => 'circuit_type', - }, - { columns => [ 'providernum' ], - table => 'circuit_provider', - }, - { columns => [ 'termnum' ], - table => 'circuit_termination', - }, - ], }, %{ tables_hashref_torrus() }, @@ -4675,6 +4760,8 @@ sub tables_hashref { 'latexsmallfooter', 'text', 'NULL', '', '', '', 'latexreturnaddress', 'text', 'NULL', '', '', '', 'with_latexcoupon', 'char', 'NULL', '1', '', '', + 'htmlwatermark', 'text', 'NULL', '', '', '', + 'latexwatermark', 'text', 'NULL', '', '', '', 'lpr', 'varchar', 'NULL', $char_d, '', '', ], 'primary_key' => 'confnum', @@ -4693,12 +4780,6 @@ sub tables_hashref { 'primary_key' => 'batchnum', 'unique' => [], 'index' => [ [ 'exportnum' ], [ 'status' ] ], - 'foreign_keys' => [ - { columns => [ 'exportnum' ], - table => 'part_export', - references => [ 'exportnum' ] - }, - ], }, 'export_batch_item' => { @@ -4713,12 +4794,6 @@ sub tables_hashref { 'primary_key' => 'itemnum', 'unique' => [], 'index' => [ [ 'batchnum' ], [ 'svcnum' ] ], - 'foreign_keys' => [ - { columns => [ 'batchnum' ], - table => 'export_batch', - references => [ 'batchnum' ] - }, - ], }, # lookup table for states, similar to msa and lata @@ -4740,6 +4815,7 @@ sub tables_hashref { 'zonenum', 'serial', '', '', '', '', 'description', 'char', 'NULL', $char_d, '', '', 'agentnum', 'int', '', '', '', '', + 'censusyear', 'char', 'NULL', 4, '', '', 'dbaname', 'char', 'NULL', $char_d, '', '', 'zonetype', 'char', '', 1, '', '', 'technology', 'int', '', '', '', '', @@ -4758,12 +4834,6 @@ sub tables_hashref { 'primary_key' => 'zonenum', 'unique' => [], 'index' => [ [ 'agentnum' ] ], - 'foreign_keys' => [ - { columns => [ 'agentnum' ], - table => 'agent', - references => [ 'agentnum' ], - }, - ], }, 'deploy_zone_block' => { @@ -4771,17 +4841,11 @@ sub tables_hashref { 'blocknum', 'serial', '', '', '', '', 'zonenum', 'int', '', '', '', '', 'censusblock', 'char', '', 15, '', '', - 'censusyear', 'char', '', 4, '', '', + 'censusyear', 'char','NULL', 4, '', '', ], 'primary_key' => 'blocknum', 'unique' => [], 'index' => [ [ 'zonenum' ] ], - 'foreign_keys' => [ - { columns => [ 'zonenum' ], - table => 'deploy_zone', - references => [ 'zonenum' ], - }, - ], }, 'deploy_zone_vertex' => { @@ -4794,17 +4858,98 @@ sub tables_hashref { 'primary_key' => 'vertexnum', 'unique' => [ ], 'index' => [ ], + }, + + 'cacti_page' => { + 'columns' => [ + 'cacti_pagenum', 'serial', '', '', '', '', + 'exportnum', 'int', 'NULL', '', '', '', + 'svcnum', 'int', 'NULL', '', '', '', + 'graphnum', 'int', 'NULL', '', '', '', + 'imported', @date_type, '', '', + 'content', 'text', 'NULL', '', '', '', + ], + 'primary_key' => 'cacti_pagenum', + 'unique' => [ ], + 'index' => [ ['svcnum'], ['imported'] ], + }, + + 'report_batch' => { + 'columns' => [ + 'reportbatchnum', 'serial', '', '', '', '', + 'reportname', 'varchar', '', 255, '', '', + 'agentnum', 'int', 'NULL', '', '', '', + 'send_date', @date_type, '', '', + 'sdate', @date_type, '', '', + 'edate', @date_type, '', '', + 'usernum', 'int', 'NULL', '', '', '', + 'msgnum', 'int', 'NULL', '', '', '', + # add report params here as necessary + ], + 'primary_key' => 'reportbatchnum', + 'unique' => [], + 'index' => [], 'foreign_keys' => [ - { columns => [ 'zonenum' ], - table => 'deploy_zone', - references => [ 'zonenum' ], + { columns => [ 'agentnum' ], + table => 'agent', + references => [ 'agentnum' ], + }, + { columns => [ 'usernum' ], + table => 'access_user', + references => [ 'usernum' ], + }, + { columns => [ 'msgnum' ], + table => 'msg_template', + references => [ 'msgnum' ], }, ], }, - - - + 'password_history' => { + 'columns' => [ + 'passwordnum', 'serial', '', '', '', '', + '_password', 'varchar', 'NULL', $char_d, '', '', + 'encryption_method', 'varchar', 'NULL', $char_d, '', '', + 'created', @date_type, '', '', + # each table that needs password history gets a column here, and + # an entry in foreign_keys. + 'svc_acct__svcnum', 'int', 'NULL', '', '', '', + 'svc_dsl__svcnum', 'int', 'NULL', '', '', '', + 'svc_alarm__svcnum', 'int', 'NULL', '', '', '', + 'agent__agentnum', 'int', 'NULL', '', '', '', + 'contact__contactnum', 'int', 'NULL', '', '', '', + 'access_user__usernum', 'int', 'NULL', '', '', '', + ], + 'primary_key' => 'passwordnum', + 'unique' => [], + 'index' => [], + 'foreign_keys' => [ + { columns => [ 'svc_acct__svcnum' ], + table => 'svc_acct', + references => [ 'svcnum' ], + }, + { columns => [ 'svc_dsl__svcnum' ], + table => 'svc_dsl', + references => [ 'svcnum' ], + }, + { columns => [ 'svc_alarm__svcnum' ], + table => 'svc_alarm', + references => [ 'svcnum' ], + }, + { columns => [ 'agent__agentnum' ], + table => 'agent', + references => [ 'agentnum' ], + }, + { columns => [ 'contact__contactnum' ], + table => 'contact', + references => [ 'contactnum' ], + }, + { columns => [ 'access_user__usernum' ], + table => 'access_user', + references => [ 'usernum' ], + }, + ], + }, # name type nullability length default local