X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FSchema.pm;h=04e5dd4c89d51fd00e62de225c18436dbbedf3f8;hb=edea94b6bd41a3fceac47267a3df3dc7fcf7c565;hp=6486eed48728139e13ac0a0ee001d7cb6abcc942;hpb=73641bbccaf310777a01dcfc17d7f60e2757e73a;p=freeside.git diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 6486eed48..04e5dd4c8 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -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) @@ -662,6 +679,7 @@ sub tables_hashref { 'invoice_terms', 'varchar', 'NULL', $char_d, '', '', #customer balance info at invoice generation time + #(deprecated) 'previous_balance', @money_typen, '', '', #eventually not nullable 'billing_balance', @money_typen, '', '', #eventually not nullable @@ -1793,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', @@ -1804,6 +1823,9 @@ sub tables_hashref { { columns => [ 'custnum' ], table => 'cust_main', }, + { columns => [ 'refnum' ], + table => 'part_referral', + }, ], }, @@ -2586,8 +2608,9 @@ sub tables_hashref { 'index' => [ ['custnum'], ['pkgpart'], ['pkgbatch'], ['locationnum'], ['usernum'], ['agent_pkgid'], ['order_date'], [ 'start_date' ], ['setup'], ['bill'], - ['last_bill'], ['susp'], ['adjourn'], ['cancel'], - ['expire'], ['contract_end'], ['change_date'], + ['last_bill'], ['susp'], ['adjourn'], ['resume'], + ['cancel'], ['expire'], ['contract_end'], + ['change_date'], ['no_auto'], #['contactnum'], ['salesnum'], @@ -3029,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', @@ -6246,7 +6270,7 @@ sub tables_hashref { 'columns' => [ 'logcontextnum', 'serial', '', '', '', '', 'lognum', 'int', '', '', '', '', - 'context', 'varchar', '', 32, '', '', + 'context', 'varchar', '', $char_d, '', '', ], 'primary_key' => 'logcontextnum', 'unique' => [ [ 'lognum', 'context' ] ], @@ -6350,7 +6374,7 @@ sub tables_hashref { 'mac_addr', 'varchar', 'NULL', 12, '', '', ], 'primary_key' => 'svcnum', - 'unique' => [], + 'unique' => [ ['serialnum'] , ['mac_addr'] ], 'index' => [], 'foreign_keys' => [ { columns => [ 'svcnum' ], @@ -6671,6 +6695,77 @@ sub tables_hashref { 'index' => [], }, + # eventually link to tower/sector? + 'deploy_zone' => { + 'columns' => [ + 'zonenum', 'serial', '', '', '', '', + 'description', 'char', 'NULL', $char_d, '', '', + 'agentnum', 'int', '', '', '', '', + 'dbaname', 'char', 'NULL', $char_d, '', '', + 'zonetype', 'char', '', 1, '', '', + 'technology', 'int', '', '', '', '', + 'spectrum', 'int', 'NULL', '', '', '', + 'adv_speed_up', 'decimal', '', '10,3', '0', '', + 'adv_speed_down', 'decimal', '', '10,3', '0', '', + 'cir_speed_up', 'decimal', '', '10,3', '0', '', + 'cir_speed_down', 'decimal', '', '10,3', '0', '', + 'is_broadband', 'char', 'NULL', 1, '', '', + 'is_voice', 'char', 'NULL', 1, '', '', + 'is_consumer', 'char', 'NULL', 1, '', '', + 'is_business', 'char', 'NULL', 1, '', '', + 'active_date', @date_type, '', '', + 'expire_date', @date_type, '', '', + ], + 'primary_key' => 'zonenum', + 'unique' => [], + 'index' => [ [ 'agentnum' ] ], + 'foreign_keys' => [ + { columns => [ 'agentnum' ], + table => 'agent', + references => [ 'agentnum' ], + }, + ], + }, + + 'deploy_zone_block' => { + 'columns' => [ + 'blocknum', 'serial', '', '', '', '', + 'zonenum', 'int', '', '', '', '', + 'censusblock', 'char', '', 15, '', '', + 'censusyear', 'char', '', 4, '', '', + ], + 'primary_key' => 'blocknum', + 'unique' => [], + 'index' => [ [ 'zonenum' ] ], + 'foreign_keys' => [ + { columns => [ 'zonenum' ], + table => 'deploy_zone', + references => [ 'zonenum' ], + }, + ], + }, + + 'deploy_zone_vertex' => { + 'columns' => [ + 'vertexnum', 'serial', '', '', '', '', + 'zonenum', 'int', '', '', '', '', + 'latitude', 'decimal', '', '10,7', '', '', + 'longitude', 'decimal', '', '10,7', '', '', + ], + 'primary_key' => 'vertexnum', + 'unique' => [ ], + 'index' => [ ], + 'foreign_keys' => [ + { columns => [ 'zonenum' ], + table => 'deploy_zone', + references => [ 'zonenum' ], + }, + ], + }, + + + + # name type nullability length default local