X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FSchema.pm;h=862e40afa19d8318f3b6cdaff6f61ff67f9783a8;hb=d535444f90993fb7b16928e3f2f342603016623b;hp=ebf4f37dad95375b1eddf1a0639a0b171651f95f;hpb=0be78acfcd733ca079ab946f4ba4b46429c28c1c;p=freeside.git diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index ebf4f37da..862e40afa 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; @@ -1003,12 +1003,12 @@ sub tables_hashref { { columns => [ 'billpkgnum' ], table => 'cust_bill_pkg', }, - { columns => [ 'pkgnum' ], - table => 'cust_pkg', - }, - { columns => [ 'invnum' ], - table => 'cust_bill', - }, + #{ columns => [ 'pkgnum' ], + # table => 'cust_pkg', + #}, + #{ columns => [ 'invnum' ], + # table => 'cust_bill', + #}, { columns => [ 'classnum' ], table => 'usage_class', }, @@ -1176,12 +1176,12 @@ sub tables_hashref { { columns => [ 'billpkgnum' ], table => 'cust_bill_pkg_void', }, - { columns => [ 'pkgnum' ], - table => 'cust_pkg', - }, - { columns => [ 'invnum' ], - table => 'cust_bill', - }, + #{ columns => [ 'pkgnum' ], + # table => 'cust_pkg', + #}, + #{ columns => [ 'invnum' ], + # table => 'cust_bill', + #}, { columns => [ 'classnum' ], table => 'usage_class', }, @@ -1672,7 +1672,10 @@ sub tables_hashref { 'first', 'varchar', '', $char_d, '', '', 'title', 'varchar', 'NULL', $char_d, '', '', #eg Head Bottle Washer 'comment', 'varchar', 'NULL', 255, '', '', - 'disabled', 'char', 'NULL', 1, '', '', + 'selfservice_access', 'char', 'NULL', 1, '', '', + '_password', 'varchar', 'NULL', $char_d, '', '', + '_password_encoding', 'varchar', 'NULL', $char_d, '', '', + 'disabled', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'contactnum', 'unique' => [], @@ -1736,7 +1739,8 @@ sub tables_hashref { 'emailaddress', 'varchar', '', $char_d, '', '', ], 'primary_key' => 'contactemailnum', - 'unique' => [ [ 'contactnum', 'emailaddress' ], ], + #'unique' => [ [ 'contactnum', 'emailaddress' ], ], + 'unique' => [ [ 'emailaddress' ], ], 'index' => [], 'foreign_keys' => [ { columns => [ 'contactnum' ], @@ -3656,8 +3660,8 @@ sub tables_hashref { 'classname', 'varchar', '', $char_d, '', '', ], 'primary_key' => 'classnum', - 'unique' => [ ], - 'index' => [ ], + 'unique' => [], + 'index' => [], }, 'hardware_type' => { @@ -3684,8 +3688,8 @@ sub tables_hashref { 'disabled', 'char', 'NULL', 1, '', '', ], 'primary_key' => 'statusnum', - 'unique' => [ ], - 'index' => [ ], + 'unique' => [], + 'index' => [], }, 'domain_record' => { @@ -3890,7 +3894,8 @@ sub tables_hashref { 'index' => [], 'foreign_keys' => [ { columns => [ 'svcnum' ], - table => 'svc_broadband', + table => 'svc_broadband',#no? could be _acct? + #remove or cust_svc? }, ], }, @@ -3954,6 +3959,7 @@ sub tables_hashref { 'foreign_keys' => [ { columns => [ 'jobnum' ], table => 'queue', + on_delete => 'CASCADE', }, ], }, @@ -3974,6 +3980,7 @@ sub tables_hashref { { columns => [ 'depend_jobnum' ], table => 'queue', references => [ 'jobnum' ], + on_delete => 'CASCADE', }, ], }, @@ -4276,6 +4283,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', '', '', '', '', @@ -5910,21 +5929,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', + }, ], },