X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=bin%2Ffs-setup;h=4e64f1bdfb3757d7fdb48cbe8ec0e13224db461c;hb=60b5717194d18401d8532ca8b09376edeea535d7;hp=45332d85ca7d0479019ce63a4643047310bf2ea7;hpb=cad4eadf964cb65841d7cb6f0bcf804f1d39ae2c;p=freeside.git diff --git a/bin/fs-setup b/bin/fs-setup index 45332d85c..4e64f1bdf 100755 --- a/bin/fs-setup +++ b/bin/fs-setup @@ -30,6 +30,17 @@ # ivan@sisd.com 98-sep-4 # # fix radius attributes ivan@sisd.com 98-sep-27 +# +# $Log: fs-setup,v $ +# Revision 1.5 1998-11-15 09:43:03 ivan +# update for new config file syntax, new adminsuidsetup +# +# Revision 1.4 1998/10/22 15:51:23 ivan +# also varchar with no length specified - postgresql fix broke mysql. +# +# Revision 1.3 1998/10/22 15:46:28 ivan +# now smallint is illegal, so remove that too. +# #to delay loading dbdef until we're ready BEGIN { $FS::Record::setup_hack = 1; } @@ -41,8 +52,11 @@ use FS::UID qw(adminsuidsetup datasrc); use FS::Record; use FS::cust_main_county; +my $user = shift or die &usage; +FS::UID::getsecrets $user; + #needs to match FS::Record -my($dbdef_file) = "/var/spool/freeside/dbdef.". datasrc; +my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc; ### @@ -68,7 +82,7 @@ my($char_d) = 80; #default maxlength for text fields #my(@date_type) = ( 'timestamp', '', '' ); my(@date_type) = ( 'int', 'NULL', '' ); -my(@perl_type) = ( 'long varchar', 'NULL', '' ); +my(@perl_type) = ( 'varchar', 'NULL', 255 ); my(@money_type); if (datasrc =~ m/Pg/) { #Pg can't do decimal(10,2) @money_type = ( 'money', '', '' ); @@ -143,13 +157,14 @@ foreach (qw(svc_acct svc_acct_sm svc_domain)) { #important $dbdef->save($dbdef_file); -FS::Record::reload_dbdef; +FS::Record::reload_dbdef($dbdef_file); ### # create 'em ### -my($dbh)=adminsuidsetup; +my($dbh)=adminsuidsetup $user; +warn $dbh; #create tables $|=1; @@ -190,6 +205,10 @@ SC SD TN TX TT UT VT VI VA WA WV WI WY AE AA AP $dbh->disconnect or die $dbh->errstr; +sub usage { + die "Usage:\n fs-setup user\n"; +} + ### # Now it becomes an object. much better. ### @@ -206,7 +225,7 @@ sub tables_hash_hack { 'agentnum', 'int', '', '', 'agent', 'varchar', '', $char_d, 'typenum', 'int', '', '', - 'freq', 'smallint', 'NULL', '', + 'freq', 'int', 'NULL', '', 'prog', @perl_type, ], 'primary_key' => 'agentnum', @@ -315,7 +334,7 @@ sub tables_hash_hack { 'columns' => [ 'taxnum', 'int', '', '', 'state', 'char', '', 2, #two letters max in US... elsewhere? - 'county', 'varchar', '', $char_d, + 'county', 'varchar', 'NULL', $char_d, 'tax', 'real', '', '', #tax % ], 'primary_key' => 'taxnum', @@ -353,7 +372,7 @@ sub tables_hash_hack { 'state', 'char', '', 2, 'zip', 'varchar', '', 10, 'country', 'char', '', 2, - 'trancode', 'TINYINT', '', '', + 'trancode', 'int', '', '', 'cardnum', 'varchar', '', 16, 'exp', @date_type, 'payname', 'varchar', 'NULL', $char_d, @@ -415,7 +434,7 @@ sub tables_hash_hack { 'pkg', 'varchar', '', $char_d, 'comment', 'varchar', '', $char_d, 'setup', @perl_type, - 'freq', 'smallint', '', '', #billing frequency (months) + 'freq', 'int', '', '', #billing frequency (months) 'recur', @perl_type, ], 'primary_key' => 'pkgpart', @@ -476,8 +495,8 @@ sub tables_hash_hack { 'username', 'varchar', '', $username_len, #unique (& remove dup code) '_password', 'varchar', '', 25, #13 for encryped pw's plus ' *SUSPENDED* 'popnum', 'int', 'NULL', '', - 'uid', 'bigint', 'NULL', '', - 'gid', 'bigint', 'NULL', '', + 'uid', 'int', 'NULL', '', + 'gid', 'int', 'NULL', '', 'finger', 'varchar', 'NULL', $char_d, 'dir', 'varchar', 'NULL', $char_d, 'shell', 'varchar', 'NULL', $char_d, @@ -493,7 +512,7 @@ sub tables_hash_hack { 'columns' => [ 'svcnum', 'int', '', '', 'domsvc', 'int', '', '', - 'domuid', 'bigint', '', '', + 'domuid', 'int', '', '', 'domuser', 'varchar', '', $char_d, ], 'primary_key' => 'svcnum',