X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FSchema.pm;h=647e2b106d21fff54d0859a446dc2ecdf1218566;hb=430b2c784d2ee9ea5be00b821d2dbd27279ef132;hp=8ba60200edabb0fa3a2188e36956e74aa5f9d221;hpb=df1ebf662a9fc3f89503036e0dbf6833c1b95f9e;p=freeside.git diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 8ba60200e..647e2b106 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -3,7 +3,7 @@ package FS::Schema; use vars qw(@ISA @EXPORT_OK $DEBUG $setup_hack %dbdef_cache); use subs qw(reload_dbdef); use Exporter; -use DBIx::DBSchema 0.43; #0.43 for foreign keys +use DBIx::DBSchema 0.44; #for foreign keys with MATCH / ON DELETE/UPDATE use DBIx::DBSchema::Table; use DBIx::DBSchema::Column; use DBIx::DBSchema::Index; @@ -1138,9 +1138,10 @@ sub tables_hashref { { columns => [ 'invnum' ], table => 'cust_bill_void', }, - { columns => [ 'pkgnum' ], - table => 'cust_pkg', - }, + #pkgnum 0 and -1 are used for special things + #{ columns => [ 'pkgnum' ], + # table => 'cust_pkg', + #}, { columns => [ 'pkgpart_override' ], table => 'part_pkg', references => [ 'pkgpart' ], @@ -2389,7 +2390,7 @@ sub tables_hashref { 'index' => [ [ 'billpaynum' ], [ 'billpkgnum' ], ], 'foreign_keys' => [ { columns => [ 'billpaynum' ], - table => 'cust_bill_pay_batch', + table => 'cust_bill_pay', }, { columns => [ 'billpkgnum' ], table => 'cust_bill_pkg', @@ -3953,6 +3954,7 @@ sub tables_hashref { 'foreign_keys' => [ { columns => [ 'jobnum' ], table => 'queue', + on_delete => 'CASCADE', }, ], }, @@ -3973,6 +3975,7 @@ sub tables_hashref { { columns => [ 'depend_jobnum' ], table => 'queue', references => [ 'jobnum' ], + on_delete => 'CASCADE', }, ], }, @@ -4275,6 +4278,18 @@ sub tables_hashref { ], }, + 'addr_range' => { + 'columns' => [ + 'rangenum', 'serial', '', '', '', '', + 'start', 'varchar', '', 15, '', '', + 'length', 'int', '', '', '', '', + 'status', 'varchar', 'NULL', 32, '', '', + ], + 'primary_key' => 'rangenum', + 'unique' => [], + 'index' => [], + }, + 'svc_broadband' => { 'columns' => [ 'svcnum', 'int', '', '', '', '', @@ -4903,7 +4918,7 @@ sub tables_hashref { #currently only u4: # terminating number (as opposed to dialed destination) - 'dst_term', 'varchar', '', $char_d, \"''", '', + 'dst_term', 'varchar', 'NULL', $char_d, '', '', #these don't seem to be logged by most of the SQL cdr_* modules #except tds under sql-illegal names, so; @@ -5843,7 +5858,7 @@ sub tables_hashref { 'statustext', 'varchar', 'NULL', $char_d, '', '', ], 'primary_key' => 'upgradenum', - 'unique' => [ [ 'upgradenum' ] ], + 'unique' => [], 'index' => [ [ 'upgrade' ] ], }, @@ -5909,21 +5924,82 @@ sub tables_hashref { 'svc_alarm' => { 'columns' => [ 'svcnum', 'int', '', '', '', '', - 'alarm_system', 'varchar', '', $char_d, '', '', # dropdowns? - 'alarm_type', 'varchar', '', $char_d, '', '', # + 'alarmsystemnum', 'int', '', '', '', '', + 'alarmtypenum', 'int', '', '', '', '', + 'alarmstationnum', 'int', '', '', '', '', 'acctnum', 'varchar', '', $char_d, '', '', '_password', 'varchar', '', $char_d, '', '', 'location', 'varchar', 'NULL', $char_d, '', '', - #cs - #rep + #installer (rep) ], 'primary_key' => 'svcnum', - 'unique' => [], #system/type/acctnum?? + 'unique' => [], 'index' => [], 'foreign_keys' => [ { columns => [ 'svcnum' ], table => 'cust_svc', }, + { columns => [ 'alarmsystemnum' ], + table => 'alarm_system', + }, + { columns => [ 'alarmtypenum' ], + table => 'alarm_type', + }, + { columns => [ 'alarmstationnum' ], + table => 'alarm_station', + }, + ], + }, + + 'alarm_system' => { #vendors + 'columns' => [ + 'alarmsystemnum', 'serial', '', '', '', '', + 'agentnum', 'int', 'NULL', '', '', '', + 'systemname', 'varchar', '', $char_d, '', '', + 'disabled', 'char', 'NULL', 1, '', '', + ], + 'primary_key' => 'alarmsystemnum', + 'unique' => [ ['agentnum', 'systemname'] ], + 'index' => [ ['agentnum'], ['disabled'] ], + 'foreign_keys' => [ + { columns => [ 'agentnum' ], + table => 'agent', + }, + ], + }, + + 'alarm_type' => { #inputs and outputs + 'columns' => [ + 'alarmtypenum', 'serial', '', '', '', '', + 'agentnum', 'int', 'NULL', '', '', '', + 'inputs', 'int', '', '', '', '', + 'outputs', 'int', '', '', '', '', + 'disabled', 'char', 'NULL', 1, '', '', + ], + 'primary_key' => 'alarmtypenum', + 'unique' => [ ['agentnum', 'inputs', 'outputs'] ], + 'index' => [ ['agentnum'], ['disabled'] ], + 'foreign_keys' => [ + { columns => [ 'agentnum' ], + table => 'agent', + }, + ], + }, + + 'alarm_station' => { #central station (where the alarm reports to) + 'columns' => [ + 'alarmstationnum', 'serial', '', '', '', '', + 'agentnum', 'int', 'NULL', '', '', '', + 'stationname', 'varchar', '', $char_d, '', '', + 'disabled', 'char', 'NULL', 1, '', '', + ], + 'primary_key' => 'alarmstationnum', + 'unique' => [ ['agentnum', 'stationname'], ], + 'index' => [ ['agentnum'], ['disabled'] ], + 'foreign_keys' => [ + { columns => [ 'agentnum' ], + table => 'agent', + }, ], },