X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Ffs-setup;h=2a37fb8d752b4c38ae886dbdf164c4c4af0e979b;hb=15f65a0c56cbce6951d9cb4f71119725a2009f79;hp=7a5403b012a9fb929334763a5f624ccb172c3777;hpb=532db8ddd43eae7f09200ad25fbc542524f2093d;p=freeside.git diff --git a/bin/fs-setup b/bin/fs-setup index 7a5403b01..2a37fb8d7 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: fs-setup,v 1.15 1999-02-27 21:06:21 ivan Exp $ +# $Id: fs-setup,v 1.34 2001-04-09 23:05:16 ivan Exp $ # # ivan@sisd.com 97-nov-8,9 # @@ -32,7 +32,61 @@ # fix radius attributes ivan@sisd.com 98-sep-27 # # $Log: fs-setup,v $ -# Revision 1.15 1999-02-27 21:06:21 ivan +# Revision 1.34 2001-04-09 23:05:16 ivan +# Transactions Part I!!! +# +# Revision 1.33 2001/02/03 14:03:50 ivan +# time-based prepaid cards, session monitor. woop! +# +# Revision 1.32 2000/12/04 00:13:02 ivan +# fix nas.last type +# +# Revision 1.31 2000/12/01 18:34:53 ivan +# another tyop +# +# Revision 1.30 2000/12/01 18:33:32 ivan +# tyop +# +# Revision 1.29 2000/11/07 15:00:37 ivan +# session monitor +# +# Revision 1.28 2000/10/30 10:47:26 ivan +# nas.last can't be defined NULL if indexed +# +# Revision 1.26 2000/07/06 08:57:27 ivan +# support for radius check attributes (except importing). poorly documented. +# +# Revision 1.25 2000/06/29 12:00:49 ivan +# support for pre-encrypted md5 passwords. +# +# Revision 1.24 2000/03/02 07:44:07 ivan +# typo forgot closing ' +# +# Revision 1.23 2000/02/03 05:16:52 ivan +# beginning of DNS and Apache support +# +# Revision 1.22 2000/01/31 05:22:23 ivan +# prepaid "internet cards" +# +# Revision 1.21 2000/01/30 06:03:26 ivan +# postgres 6.5 finally supports decimal(10,2) +# +# Revision 1.20 2000/01/28 22:53:33 ivan +# track full phone number +# +# Revision 1.19 1999/07/29 08:50:35 ivan +# wrong type for cust_pay_batch.exp +# +# Revision 1.18 1999/04/15 22:46:30 ivan +# TT isn't a state! +# +# Revision 1.17 1999/04/14 07:58:39 ivan +# export getsecrets from FS::UID instead of calling it explicitly +# +# Revision 1.16 1999/02/28 19:44:16 ivan +# constructors s/create/new/ pointed out by "Bao C. Ha" +# +# Revision 1.15 1999/02/27 21:06:21 ivan # cust_main.paydate should be varchar(10), not @date_type ; problem reported # by Ben Leibig # @@ -79,14 +133,14 @@ BEGIN { $FS::Record::setup_hack = 1; } use strict; use DBI; use FS::dbdef; -use FS::UID qw(adminsuidsetup datasrc checkeuid); +use FS::UID qw(adminsuidsetup datasrc checkeuid getsecrets); use FS::Record; use FS::cust_main_county; die "Not running uid freeside!" unless checkeuid(); my $user = shift or die &usage; -FS::UID::getsecrets $user; +getsecrets($user); #needs to match FS::Record my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc; @@ -97,9 +151,16 @@ print "\nEnter the maximum username length: "; my($username_len)=&getvalue; print "\n\n", <addcolumn( new FS::dbdef_column ( + 'rc_'. $attribute, + 'varchar', + 'NULL', + $char_d, + )); +} + #make part_svc table (but now as object) my($part_svc)=$dbdef->table('part_svc'); @@ -168,7 +233,7 @@ my($part_svc)=$dbdef->table('part_svc'); #because of svc_acct_pop #foreach (grep /^svc_/, $dbdef->tables) { #foreach (qw(svc_acct svc_acct_sm svc_charge svc_domain svc_wo)) { -foreach (qw(svc_acct svc_acct_sm svc_domain)) { +foreach (qw(svc_acct svc_acct_sm svc_domain svc_www)) { my($table)=$dbdef->table($_); my($col); foreach $col ( $table->columns ) { @@ -226,9 +291,9 @@ foreach ($dbdef->tables) { foreach ( qw( AL AK AS AZ AR CA CO CT DC DE FM FL GA GU HI ID IL IN IA KS KY LA ME MH MD MA MI MN MS MO MT NC ND NE NH NJ NM NV NY MP OH OK OR PA PW PR RI -SC SD TN TX TT UT VT VI VA WA WV WI WY AE AA AP +SC SD TN TX UT VT VI VA WA WV WI WY AE AA AP ) ) { - my($cust_main_county)=create FS::cust_main_county({ + my($cust_main_county)=new FS::cust_main_county({ 'state' => $_, 'tax' => 0, 'country' => 'US', @@ -242,7 +307,7 @@ SC SD TN TX TT UT VT VI VA WA WV WI WY AE AA AP foreach ( qw( VIC NSW NT QLD TAS ACT WA SA ) ) { - my($cust_main_county)=create FS::cust_main_county({ + my($cust_main_county)=new FS::cust_main_county({ 'state' => $_, 'tax' => 0, 'country' => 'AU', @@ -265,7 +330,7 @@ ST SA SN SC SL SG SK SI SB SO ZA GS ES LK SH PM SD SR SJ SZ SE CH SY TW TJ TZ TH TG TK TO TT TN TR TM TC TV UG UA AE GB UM UY UZ VU VA VE VN VG VI WF EH YE YU ZR ZM ZW ) ) { - my($cust_main_county)=create FS::cust_main_county({ + my($cust_main_county)=new FS::cust_main_county({ 'tax' => 0, 'country' => $_, }); @@ -330,7 +395,6 @@ sub tables_hash_hack { 'custnum', 'int', '', '', '_date', @date_type, 'charged', @money_type, - 'owed', @money_type, 'printed', 'int', '', '', ], 'primary_key' => 'invnum', @@ -358,7 +422,6 @@ sub tables_hash_hack { 'custnum', 'int', '', '', '_date', @date_type, 'amount', @money_type, - 'credited', @money_type, 'otaker', 'varchar', '', 8, 'reason', 'varchar', '', 255, ], @@ -460,7 +523,8 @@ sub tables_hash_hack { 'country', 'char', '', 2, 'trancode', 'int', '', '', 'cardnum', 'varchar', '', 16, - 'exp', @date_type, + #'exp', @date_type, + 'exp', 'varchar', '', 11, 'payname', 'varchar', 'NULL', $char_d, 'amount', @money_type, ], @@ -578,7 +642,7 @@ sub tables_hash_hack { 'state', 'varchar', '', $char_d, 'ac', 'char', '', 3, 'exch', 'char', '', 3, - #rest o' number? + 'loc', 'char', 'NULL', 4, #NULL for legacy purposes ], 'primary_key' => 'popnum', 'unique' => [ [] ], @@ -589,7 +653,7 @@ sub tables_hash_hack { 'columns' => [ 'svcnum', 'int', '', '', 'username', 'varchar', '', $username_len, #unique (& remove dup code) - '_password', 'varchar', '', 25, #13 for encryped pw's plus ' *SUSPENDED* + '_password', 'varchar', '', 50, #13 for encryped pw's plus ' *SUSPENDED* (mp5 passwords can be 34) 'popnum', 'int', 'NULL', '', 'uid', 'int', 'NULL', '', 'gid', 'int', 'NULL', '', @@ -598,6 +662,7 @@ sub tables_hash_hack { 'shell', 'varchar', 'NULL', $char_d, 'quota', 'varchar', 'NULL', $char_d, 'slipip', 'varchar', 'NULL', 15, #four TINYINTs, bah. + 'seconds', 'int', 'NULL', '', #uhhhh ], 'primary_key' => 'svcnum', 'unique' => [ [] ], @@ -636,6 +701,31 @@ sub tables_hash_hack { 'index' => [ [] ], }, + 'domain_record' => { + 'columns' => [ + 'recnum', 'int', '', '', + 'svcnum', 'int', '', '', + 'reczone', 'varchar', '', $char_d, + 'recaf', 'char', '', 2, + 'rectype', 'char', '', 5, + 'recdata', 'varchar', '', $char_d, + ], + 'primary_key' => 'recnum', + 'unique' => [ [] ], + 'index' => [ ['svcnum'] ], + }, + + 'svc_www' => { + 'columns' => [ + 'svcnum', 'int', '', '', + 'recnum', 'int', '', '', + 'usersvc', 'int', '', '', + ], + 'primary_key' => 'svcnum', + 'unique' => [ [] ], + 'index' => [ [] ], + }, + #'svc_wo' => { # 'columns' => [ # 'svcnum', 'int', '', '', @@ -649,6 +739,56 @@ sub tables_hash_hack { # 'index' => [ [] ], #}, + 'prepay_credit' => { + 'columns' => [ + 'prepaynum', 'int', '', '', + 'identifier', 'varchar', '', $char_d, + 'amount', @money_type, + 'seconds', 'int', 'NULL', '', + ], + 'primary_key' => 'prepaynum', + 'unique' => [ ['identifier'] ], + 'index' => [ [] ], + }, + + 'port' => { + 'columns' => [ + 'portnum', 'int', '', '', + 'ip', 'varchar', 'NULL', 15, + 'nasport', 'int', 'NULL', '', + 'nasnum', 'int', '', '', + ], + 'primary_key' => 'portnum', + 'unique' => [], + 'index' => [], + }, + + 'nas' => { + 'columns' => [ + 'nasnum', 'int', '', '', + 'nas', 'varchar', '', $char_d, + 'nasip', 'varchar', '', 15, + 'nasfqdn', 'varchar', '', $char_d, + 'last', 'int', '', '', + ], + 'primary_key' => 'nasnum', + 'unique' => [ [ 'nas' ], [ 'nasip' ] ], + 'index' => [ [ 'last' ] ], + }, + + 'session' => { + 'columns' => [ + 'sessionnum', 'int', '', '', + 'portnum', 'int', '', '', + 'svcnum', 'int', '', '', + 'login', @date_type, + 'logout', @date_type, + ], + 'primary_key' => 'sessionnum', + 'unique' => [], + 'index' => [ [ 'portnum' ] ], + }, + ); %tables;