From 8675d7f9367456118663ddc28907bcd69d6dae94 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 25 Aug 2002 01:09:50 +0000 Subject: doc --- FS/bin/freeside-setup | 1031 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1031 insertions(+) create mode 100755 FS/bin/freeside-setup (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup new file mode 100755 index 000000000..21defa6e5 --- /dev/null +++ b/FS/bin/freeside-setup @@ -0,0 +1,1031 @@ +#!/usr/bin/perl -Tw + +#to delay loading dbdef until we're ready +BEGIN { $FS::Record::setup_hack = 1; } + +use strict; +use DBI; +use DBIx::DBSchema 0.20; +use DBIx::DBSchema::Table; +use DBIx::DBSchema::Column; +use DBIx::DBSchema::ColGroup::Unique; +use DBIx::DBSchema::ColGroup::Index; +use FS::UID qw(adminsuidsetup datasrc checkeuid getsecrets); +use FS::Record; +use FS::cust_main_county; +use FS::raddb; +use FS::part_bill_event; + +die "Not running uid freeside!" unless checkeuid(); + +my %attrib2db = + map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib; + +my $user = shift or die &usage; +getsecrets($user); + +#needs to match FS::Record +my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc; + +### + +#print "\nEnter the maximum username length: "; +#my($username_len)=&getvalue; +my $username_len = 32; #usernamemax config file + +print "\n\n", <); + chop $x; + $x; +} + +sub _yesno { + print " [y/N]:"; + my $x = scalar(); + $x =~ /^y/i; +} + +### + +my($char_d) = 80; #default maxlength for text fields + +#my(@date_type) = ( 'timestamp', '', '' ); +my(@date_type) = ( 'int', 'NULL', '' ); +my(@perl_type) = ( 'text', 'NULL', '' ); +my @money_type = ( 'decimal', '', '10,2' ); + +### +# create a dbdef object from the old data structure +### + +my(%tables)=&tables_hash_hack; + +#turn it into objects +my($dbdef) = new DBIx::DBSchema ( map { + my(@columns); + while (@{$tables{$_}{'columns'}}) { + my($name,$type,$null,$length)=splice @{$tables{$_}{'columns'}}, 0, 4; + push @columns, new DBIx::DBSchema::Column ( $name,$type,$null,$length ); + } + DBIx::DBSchema::Table->new( + $_, + $tables{$_}{'primary_key'}, + DBIx::DBSchema::ColGroup::Unique->new($tables{$_}{'unique'}), + DBIx::DBSchema::ColGroup::Index->new($tables{$_}{'index'}), + @columns, + ); +} (keys %tables) ); + +my $cust_main = $dbdef->table('cust_main'); +unless ($ship) { #remove ship_ from cust_main + $cust_main->delcolumn($_) foreach ( grep /^ship_/, $cust_main->columns ); +} else { #add indices on ship_last and ship_company + push @{$cust_main->index->lol_ref}, ( ['ship_last'], ['ship_company'] ) +} + +#add radius attributes to svc_acct + +my($svc_acct)=$dbdef->table('svc_acct'); + +my($attribute); +foreach $attribute (@attributes) { + $svc_acct->addcolumn ( new DBIx::DBSchema::Column ( + 'radius_'. $attribute, + 'varchar', + 'NULL', + $char_d, + )); +} + +foreach $attribute (@check_attributes) { + $svc_acct->addcolumn( new DBIx::DBSchema::Column ( + 'rc_'. $attribute, + 'varchar', + 'NULL', + $char_d, + )); +} + +##make part_svc table (but now as object) +# +#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_domain svc_forward svc_www)) { +# my($table)=$dbdef->table($_); +# my($col); +# foreach $col ( $table->columns ) { +# next if $col =~ /^svcnum$/; +# $part_svc->addcolumn( new DBIx::DBSchema::Column ( +# $table->name. '__' . $table->column($col)->name, +# 'varchar', #$table->column($col)->type, +# 'NULL', +# $char_d, #$table->column($col)->length, +# )); +# $part_svc->addcolumn ( new DBIx::DBSchema::Column ( +# $table->name. '__'. $table->column($col)->name . "_flag", +# 'char', +# 'NULL', +# 1, +# )); +# } +#} + +#create history tables (false laziness w/create-history-tables) +foreach my $table ( grep { ! /^h_/ } $dbdef->tables ) { + my $tableobj = $dbdef->table($table) + or die "unknown table $table"; + + die "unique->lol_ref undefined for $table" + unless defined $tableobj->unique->lol_ref; + die "index->lol_ref undefined for $table" + unless defined $tableobj->index->lol_ref; + + my $h_tableobj = DBIx::DBSchema::Table->new( { + name => "h_$table", + primary_key => 'historynum', + unique => DBIx::DBSchema::ColGroup::Unique->new( [] ), + 'index' => DBIx::DBSchema::ColGroup::Index->new( [ + @{$tableobj->unique->lol_ref}, + @{$tableobj->index->lol_ref} + ] ), + columns => [ + DBIx::DBSchema::Column->new( { + 'name' => 'historynum', + 'type' => 'serial', + 'null' => 'NOT NULL', + 'length' => '', + 'default' => '', + 'local' => '', + } ), + DBIx::DBSchema::Column->new( { + 'name' => 'history_date', + 'type' => 'int', + 'null' => 'NULL', + 'length' => '', + 'default' => '', + 'local' => '', + } ), + DBIx::DBSchema::Column->new( { + 'name' => 'history_user', + 'type' => 'varchar', + 'null' => 'NOT NULL', + 'length' => '80', + 'default' => '', + 'local' => '', + } ), + DBIx::DBSchema::Column->new( { + 'name' => 'history_action', + 'type' => 'varchar', + 'null' => 'NOT NULL', + 'length' => '80', + 'default' => '', + 'local' => '', + } ), + map { $tableobj->column($_) } $tableobj->columns + ], + } ); + $dbdef->addtable($h_tableobj); +} + +#important +$dbdef->save($dbdef_file); +&FS::Record::reload_dbdef($dbdef_file); + +### +# create 'em +### + +my($dbh)=adminsuidsetup $user; + +#create tables +$|=1; + +foreach my $statement ( $dbdef->sql($dbh) ) { + $dbh->do( $statement ) + or die "CREATE error: ". $dbh->errstr. "\ndoing statement: $statement"; +} + +#not really sample data (and shouldn't default to US) + +#cust_main_county + +#USPS state codes +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 UT VT VI VA WA WV WI WY AE AA AP +) ) { + my($cust_main_county)=new FS::cust_main_county({ + 'state' => $_, + 'tax' => 0, + 'country' => 'US', + }); + my($error); + $error=$cust_main_county->insert; + die $error if $error; +} + +#AU "offical" state codes ala mark.williamson@ebbs.com.au (Mark Williamson) +foreach ( qw( +VIC NSW NT QLD TAS ACT WA SA +) ) { + my($cust_main_county)=new FS::cust_main_county({ + 'state' => $_, + 'tax' => 0, + 'country' => 'AU', + }); + my($error); + $error=$cust_main_county->insert; + die $error if $error; +} + +#ISO 2-letter country codes (same as country TLDs) except US and AU +foreach ( qw( +AF AL DZ AS AD AO AI AQ AG AR AM AW AT AZ BS BH BD BB BY BE BZ BJ BM BT BO +BA BW BV BR IO BN BG BF BI KH CM CA CV KY CF TD CL CN CX CC CO KM CG CK CR CI +HR CU CY CZ DK DJ DM DO TP EC EG SV GQ ER EE ET FK FO FJ FI FR FX GF PF TF GA +GM GE DE GH GI GR GL GD GP GU GT GN GW GY HT HM HN HK HU IS IN ID IR IQ IE IL +IT JM JP JO KZ KE KI KP KR KW KG LA LV LB LS LR LY LI LT LU MO MK MG MW MY MV +ML MT MH MQ MR MU YT MX FM MD MC MN MS MA MZ MM NA NR NP NL AN NC NZ NI NE NG +NU NF MP NO OM PK PW PA PG PY PE PH PN PL PT PR QA RE RO RU RW KN LC VC WS SM +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)=new FS::cust_main_county({ + 'tax' => 0, + 'country' => $_, + }); + my($error); + $error=$cust_main_county->insert; + die $error if $error; +} + +#billing events +foreach my $aref ( + [ 'COMP', 'Comp invoice', '$cust_bill->comp();', 30, 'comp' ], + [ 'CARD', 'Batch card', '$cust_bill->batch_card();', 40, 'batch-card' ], + [ 'BILL', 'Send invoice', '$cust_bill->send();', 50, 'send' ], +) { + + my $part_bill_event = new FS::part_bill_event({ + 'payby' => $aref->[0], + 'event' => $aref->[1], + 'eventcode' => $aref->[2], + 'seconds' => 0, + 'weight' => $aref->[3], + 'plan' => $aref->[4], + }); + my($error); + $error=$part_bill_event->insert; + die $error if $error; + +} + +$dbh->commit or die $dbh->errstr; +$dbh->disconnect or die $dbh->errstr; + +print "Freeside database initialized sucessfully\n"; + +sub usage { + die "Usage:\n fs-setup user\n"; +} + +### +# Now it becomes an object. much better. +### +sub tables_hash_hack { + + #note that s/(date|change)/_$1/; to avoid keyword conflict. + #put a kludge in FS::Record to catch this or? (pry need some date-handling + #stuff anyway also) + + my(%tables)=( #yech.} + + 'agent' => { + 'columns' => [ + 'agentnum', 'int', '', '', + 'agent', 'varchar', '', $char_d, + 'typenum', 'int', '', '', + 'freq', 'int', 'NULL', '', + 'prog', @perl_type, + ], + 'primary_key' => 'agentnum', + 'unique' => [], + 'index' => [ ['typenum'] ], + }, + + 'agent_type' => { + 'columns' => [ + 'typenum', 'int', '', '', + 'atype', 'varchar', '', $char_d, + ], + 'primary_key' => 'typenum', + 'unique' => [], + 'index' => [], + }, + + 'type_pkgs' => { + 'columns' => [ + 'typenum', 'int', '', '', + 'pkgpart', 'int', '', '', + ], + 'primary_key' => '', + 'unique' => [ ['typenum', 'pkgpart'] ], + 'index' => [ ['typenum'] ], + }, + + 'cust_bill' => { + 'columns' => [ + 'invnum', 'int', '', '', + 'custnum', 'int', '', '', + '_date', @date_type, + 'charged', @money_type, + 'printed', 'int', '', '', + 'closed', 'char', 'NULL', 1, + ], + 'primary_key' => 'invnum', + 'unique' => [], + 'index' => [ ['custnum'] ], + }, + + 'cust_bill_event' => { + 'columns' => [ + 'eventnum', 'int', '', '', + 'invnum', 'int', '', '', + 'eventpart', 'int', '', '', + '_date', @date_type, + 'status', 'varchar', '', $char_d, + 'statustext', 'text', 'NULL', '', + ], + 'primary_key' => 'eventnum', + #no... there are retries now #'unique' => [ [ 'eventpart', 'invnum' ] ], + 'unique' => [], + 'index' => [ ['invnum'], ['status'] ], + }, + + 'part_bill_event' => { + 'columns' => [ + 'eventpart', 'int', '', '', + 'payby', 'char', '', 4, + 'event', 'varchar', '', $char_d, + 'eventcode', @perl_type, + 'seconds', 'int', 'NULL', '', + 'weight', 'int', '', '', + 'plan', 'varchar', 'NULL', $char_d, + 'plandata', 'text', 'NULL', '', + 'disabled', 'char', 'NULL', 1, + ], + 'primary_key' => 'eventpart', + 'unique' => [], + 'index' => [ ['payby'] ], + }, + + 'cust_bill_pkg' => { + 'columns' => [ + 'pkgnum', 'int', '', '', + 'invnum', 'int', '', '', + 'setup', @money_type, + 'recur', @money_type, + 'sdate', @date_type, + 'edate', @date_type, + ], + 'primary_key' => '', + 'unique' => [ ['pkgnum', 'invnum'] ], + 'index' => [ ['invnum'] ], + }, + + 'cust_credit' => { + 'columns' => [ + 'crednum', 'int', '', '', + 'custnum', 'int', '', '', + '_date', @date_type, + 'amount', @money_type, + 'otaker', 'varchar', '', 8, + 'reason', 'text', 'NULL', '', + 'closed', 'char', 'NULL', 1, + ], + 'primary_key' => 'crednum', + 'unique' => [], + 'index' => [ ['custnum'] ], + }, + + 'cust_credit_bill' => { + 'columns' => [ + 'creditbillnum', 'int', '', '', + 'crednum', 'int', '', '', + 'invnum', 'int', '', '', + '_date', @date_type, + 'amount', @money_type, + ], + 'primary_key' => 'creditbillnum', + 'unique' => [], + 'index' => [ ['crednum'], ['invnum'] ], + }, + + 'cust_main' => { + 'columns' => [ + 'custnum', 'int', '', '', + 'agentnum', 'int', '', '', +# 'titlenum', 'int', 'NULL', '', + 'last', 'varchar', '', $char_d, +# 'middle', 'varchar', 'NULL', $char_d, + 'first', 'varchar', '', $char_d, + 'ss', 'char', 'NULL', 11, + 'company', 'varchar', 'NULL', $char_d, + 'address1', 'varchar', '', $char_d, + 'address2', 'varchar', 'NULL', $char_d, + 'city', 'varchar', '', $char_d, + 'county', 'varchar', 'NULL', $char_d, + 'state', 'varchar', 'NULL', $char_d, + 'zip', 'varchar', '', 10, + 'country', 'char', '', 2, + 'daytime', 'varchar', 'NULL', 20, + 'night', 'varchar', 'NULL', 20, + 'fax', 'varchar', 'NULL', 12, + 'ship_last', 'varchar', 'NULL', $char_d, +# 'ship_middle', 'varchar', 'NULL', $char_d, + 'ship_first', 'varchar', 'NULL', $char_d, + 'ship_company', 'varchar', 'NULL', $char_d, + 'ship_address1', 'varchar', 'NULL', $char_d, + 'ship_address2', 'varchar', 'NULL', $char_d, + 'ship_city', 'varchar', 'NULL', $char_d, + 'ship_county', 'varchar', 'NULL', $char_d, + 'ship_state', 'varchar', 'NULL', $char_d, + 'ship_zip', 'varchar', 'NULL', 10, + 'ship_country', 'char', 'NULL', 2, + 'ship_daytime', 'varchar', 'NULL', 20, + 'ship_night', 'varchar', 'NULL', 20, + 'ship_fax', 'varchar', 'NULL', 12, + 'payby', 'char', '', 4, + 'payinfo', 'varchar', 'NULL', $char_d, + #'paydate', @date_type, + 'paydate', 'varchar', 'NULL', 10, + 'payname', 'varchar', 'NULL', $char_d, + 'tax', 'char', 'NULL', 1, + 'otaker', 'varchar', '', 8, + 'refnum', 'int', '', '', + 'referral_custnum', 'int', 'NULL', '', + 'comments', 'text', 'NULL', '', + ], + 'primary_key' => 'custnum', + 'unique' => [], + #'index' => [ ['last'], ['company'] ], + 'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ] ], + }, + + 'cust_main_invoice' => { + 'columns' => [ + 'destnum', 'int', '', '', + 'custnum', 'int', '', '', + 'dest', 'varchar', '', $char_d, + ], + 'primary_key' => 'destnum', + 'unique' => [], + 'index' => [ ['custnum'], ], + }, + + 'cust_main_county' => { #county+state+country are checked off the + #cust_main_county for validation and to provide + # a tax rate. + 'columns' => [ + 'taxnum', 'int', '', '', + 'state', 'varchar', 'NULL', $char_d, + 'county', 'varchar', 'NULL', $char_d, + 'country', 'char', '', 2, + 'taxclass', 'varchar', 'NULL', $char_d, + 'exempt_amount', @money_type, + 'tax', 'real', '', '', #tax % + ], + 'primary_key' => 'taxnum', + 'unique' => [], + # 'unique' => [ ['taxnum'], ['state', 'county'] ], + 'index' => [], + }, + + 'cust_pay' => { + 'columns' => [ + 'paynum', 'int', '', '', + #now cust_bill_pay #'invnum', 'int', '', '', + 'custnum', 'int', '', '', + 'paid', @money_type, + '_date', @date_type, + 'payby', 'char', '', 4, # CARD/BILL/COMP, should be index into + # payment type table. + 'payinfo', 'varchar', 'NULL', 16, #see cust_main above + 'paybatch', 'varchar', 'NULL', $char_d, #for auditing purposes. + 'closed', 'char', 'NULL', 1, + ], + 'primary_key' => 'paynum', + 'unique' => [], + 'index' => [ [ 'custnum' ], [ 'paybatch' ] ], + }, + + 'cust_bill_pay' => { + 'columns' => [ + 'billpaynum', 'int', '', '', + 'invnum', 'int', '', '', + 'paynum', 'int', '', '', + 'amount', @money_type, + '_date', @date_type + ], + 'primary_key' => 'billpaynum', + 'unique' => [], + 'index' => [ [ 'paynum' ], [ 'invnum' ] ], + }, + + 'cust_pay_batch' => { #what's this used for again? list of customers + #in current CARD batch? (necessarily CARD?) + 'columns' => [ + 'paybatchnum', 'int', '', '', + 'invnum', 'int', '', '', + 'custnum', 'int', '', '', + 'last', 'varchar', '', $char_d, + 'first', 'varchar', '', $char_d, + 'address1', 'varchar', '', $char_d, + 'address2', 'varchar', 'NULL', $char_d, + 'city', 'varchar', '', $char_d, + 'state', 'varchar', 'NULL', $char_d, + 'zip', 'varchar', '', 10, + 'country', 'char', '', 2, +# 'trancode', 'int', '', '', + 'cardnum', 'varchar', '', 16, + #'exp', @date_type, + 'exp', 'varchar', '', 11, + 'payname', 'varchar', 'NULL', $char_d, + 'amount', @money_type, + ], + 'primary_key' => 'paybatchnum', + 'unique' => [], + 'index' => [ ['invnum'], ['custnum'] ], + }, + + 'cust_pkg' => { + 'columns' => [ + 'pkgnum', 'int', '', '', + 'custnum', 'int', '', '', + 'pkgpart', 'int', '', '', + 'otaker', 'varchar', '', 8, + 'setup', @date_type, + 'bill', @date_type, + 'susp', @date_type, + 'cancel', @date_type, + 'expire', @date_type, + 'manual_flag', 'char', 'NULL', 1, + ], + 'primary_key' => 'pkgnum', + 'unique' => [], + 'index' => [ ['custnum'] ], + }, + + 'cust_refund' => { + 'columns' => [ + 'refundnum', 'int', '', '', + #now cust_credit_refund #'crednum', 'int', '', '', + 'custnum', 'int', '', '', + '_date', @date_type, + 'refund', @money_type, + 'otaker', 'varchar', '', 8, + 'reason', 'varchar', '', $char_d, + 'payby', 'char', '', 4, # CARD/BILL/COMP, should be index + # into payment type table. + 'payinfo', 'varchar', 'NULL', 16, #see cust_main above + 'paybatch', 'varchar', 'NULL', $char_d, + 'closed', 'char', 'NULL', 1, + ], + 'primary_key' => 'refundnum', + 'unique' => [], + 'index' => [], + }, + + 'cust_credit_refund' => { + 'columns' => [ + 'creditrefundnum', 'int', '', '', + 'crednum', 'int', '', '', + 'refundnum', 'int', '', '', + 'amount', @money_type, + '_date', @date_type + ], + 'primary_key' => 'creditrefundnum', + 'unique' => [], + 'index' => [ [ 'crednum', 'refundnum' ] ], + }, + + + 'cust_svc' => { + 'columns' => [ + 'svcnum', 'int', '', '', + 'pkgnum', 'int', 'NULL', '', + 'svcpart', 'int', '', '', + ], + 'primary_key' => 'svcnum', + 'unique' => [], + 'index' => [ ['svcnum'], ['pkgnum'], ['svcpart'] ], + }, + + 'part_pkg' => { + 'columns' => [ + 'pkgpart', 'int', '', '', + 'pkg', 'varchar', '', $char_d, + 'comment', 'varchar', '', $char_d, + 'setup', @perl_type, + 'freq', 'int', '', '', #billing frequency (months) + 'recur', @perl_type, + 'setuptax', 'char', 'NULL', 1, + 'recurtax', 'char', 'NULL', 1, + 'plan', 'varchar', 'NULL', $char_d, + 'plandata', 'text', 'NULL', '', + 'disabled', 'char', 'NULL', 1, + 'taxclass', 'varchar', 'NULL', $char_d, + ], + 'primary_key' => 'pkgpart', + 'unique' => [], + 'index' => [], + }, + +# 'part_title' => { +# 'columns' => [ +# 'titlenum', 'int', '', '', +# 'title', 'varchar', '', $char_d, +# ], +# 'primary_key' => 'titlenum', +# 'unique' => [ [] ], +# 'index' => [ [] ], +# }, + + 'pkg_svc' => { + 'columns' => [ + 'pkgpart', 'int', '', '', + 'svcpart', 'int', '', '', + 'quantity', 'int', '', '', + ], + 'primary_key' => '', + 'unique' => [ ['pkgpart', 'svcpart'] ], + 'index' => [ ['pkgpart'] ], + }, + + 'part_referral' => { + 'columns' => [ + 'refnum', 'int', '', '', + 'referral', 'varchar', '', $char_d, + ], + 'primary_key' => 'refnum', + 'unique' => [], + 'index' => [], + }, + + 'part_svc' => { + 'columns' => [ + 'svcpart', 'int', '', '', + 'svc', 'varchar', '', $char_d, + 'svcdb', 'varchar', '', $char_d, + 'disabled', 'char', 'NULL', 1, + ], + 'primary_key' => 'svcpart', + 'unique' => [], + 'index' => [], + }, + + 'part_svc_column' => { + 'columns' => [ + 'columnnum', 'int', '', '', + 'svcpart', 'int', '', '', + 'columnname', 'varchar', '', 64, + 'columnvalue', 'varchar', 'NULL', $char_d, + 'columnflag', 'char', 'NULL', 1, + ], + 'primary_key' => 'columnnum', + 'unique' => [ [ 'svcpart', 'columnname' ] ], + 'index' => [ [ 'svcpart' ] ], + }, + + #(this should be renamed to part_pop) + 'svc_acct_pop' => { + 'columns' => [ + 'popnum', 'int', '', '', + 'city', 'varchar', '', $char_d, + 'state', 'varchar', '', $char_d, + 'ac', 'char', '', 3, + 'exch', 'char', '', 3, + 'loc', 'char', 'NULL', 4, #NULL for legacy purposes + ], + 'primary_key' => 'popnum', + 'unique' => [], + 'index' => [ [ 'state' ] ], + }, + + 'part_pop_local' => { + 'columns' => [ + 'localnum', 'int', '', '', + 'popnum', 'int', '', '', + 'city', 'varchar', 'NULL', $char_d, + 'state', 'char', 'NULL', 2, + 'npa', 'char', '', 3, + 'nxx', 'char', '', 3, + ], + 'primary_key' => 'localnum', + 'unique' => [], + 'index' => [ [ 'npa', 'nxx' ], [ 'popnum' ] ], + }, + + 'svc_acct' => { + 'columns' => [ + 'svcnum', 'int', '', '', + 'username', 'varchar', '', $username_len, #unique (& remove dup code) + '_password', 'varchar', '', 50, #13 for encryped pw's plus ' *SUSPENDED* (mp5 passwords can be 34) + 'sec_phrase', 'varchar', 'NULL', $char_d, + 'popnum', 'int', 'NULL', '', + 'uid', 'int', 'NULL', '', + 'gid', 'int', 'NULL', '', + 'finger', 'varchar', 'NULL', $char_d, + 'dir', 'varchar', 'NULL', $char_d, + 'shell', 'varchar', 'NULL', $char_d, + 'quota', 'varchar', 'NULL', $char_d, + 'slipip', 'varchar', 'NULL', 15, #four TINYINTs, bah. + 'seconds', 'int', 'NULL', '', #uhhhh + 'domsvc', 'int', '', '', + ], + 'primary_key' => 'svcnum', + #'unique' => [ [ 'username', 'domsvc' ] ], + 'unique' => [], + 'index' => [ ['username'], ['domsvc'] ], + }, + +# 'svc_acct_sm' => { +# 'columns' => [ +# 'svcnum', 'int', '', '', +# 'domsvc', 'int', '', '', +# 'domuid', 'int', '', '', +# 'domuser', 'varchar', '', $char_d, +# ], +# 'primary_key' => 'svcnum', +# 'unique' => [ [] ], +# 'index' => [ ['domsvc'], ['domuid'] ], +# }, + + #'svc_charge' => { + # 'columns' => [ + # 'svcnum', 'int', '', '', + # 'amount', @money_type, + # ], + # 'primary_key' => 'svcnum', + # 'unique' => [ [] ], + # 'index' => [ [] ], + #}, + + 'svc_domain' => { + 'columns' => [ + 'svcnum', 'int', '', '', + 'domain', 'varchar', '', $char_d, + 'catchall', 'int', 'NULL', '', + ], + 'primary_key' => 'svcnum', + 'unique' => [ ['domain'] ], + '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_forward' => { + 'columns' => [ + 'svcnum', 'int', '', '', + 'srcsvc', 'int', '', '', + 'dstsvc', 'int', '', '', + 'dst', 'varchar', 'NULL', $char_d, + ], + 'primary_key' => 'svcnum', + 'unique' => [], + 'index' => [ ['srcsvc'], ['dstsvc'] ], + }, + + 'svc_www' => { + 'columns' => [ + 'svcnum', 'int', '', '', + 'recnum', 'int', '', '', + 'usersvc', 'int', '', '', + ], + 'primary_key' => 'svcnum', + 'unique' => [], + 'index' => [], + }, + + #'svc_wo' => { + # 'columns' => [ + # 'svcnum', 'int', '', '', + # 'svcnum', 'int', '', '', + # 'svcnum', 'int', '', '', + # 'worker', 'varchar', '', $char_d, + # '_date', @date_type, + # ], + # 'primary_key' => 'svcnum', + # 'unique' => [ [] ], + # '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' ] ], + }, + + 'queue' => { + 'columns' => [ + 'jobnum', 'int', '', '', + 'job', 'text', '', '', + '_date', 'int', '', '', + 'status', 'varchar', '', $char_d, + 'statustext', 'text', 'NULL', '', + 'svcnum', 'int', 'NULL', '', + ], + 'primary_key' => 'jobnum', + 'unique' => [], + 'index' => [ [ 'svcnum' ], [ 'status' ] ], + }, + + 'queue_arg' => { + 'columns' => [ + 'argnum', 'int', '', '', + 'jobnum', 'int', '', '', + 'arg', 'text', 'NULL', '', + ], + 'primary_key' => 'argnum', + 'unique' => [], + 'index' => [ [ 'jobnum' ] ], + }, + + 'queue_depend' => { + 'columns' => [ + 'dependnum', 'int', '', '', + 'jobnum', 'int', '', '', + 'depend_jobnum', 'int', '', '', + ], + 'primary_key' => 'dependnum', + 'unique' => [], + 'index' => [ [ 'jobnum' ], [ 'depend_jobnum' ] ], + }, + + 'export_svc' => { + 'columns' => [ + 'exportsvcnum' => 'int', '', '', + 'exportnum' => 'int', '', '', + 'svcpart' => 'int', '', '', + ], + 'primary_key' => 'exportsvcnum', + 'unique' => [ [ 'exportnum', 'svcpart' ] ], + 'index' => [ [ 'exportnum' ], [ 'svcpart' ] ], + }, + + 'part_export' => { + 'columns' => [ + 'exportnum', 'int', '', '', + #'svcpart', 'int', '', '', + 'machine', 'varchar', '', $char_d, + 'exporttype', 'varchar', '', $char_d, + 'nodomain', 'char', 'NULL', 1, + ], + 'primary_key' => 'exportnum', + 'unique' => [], + 'index' => [ [ 'machine' ], [ 'exporttype' ] ], + }, + + 'part_export_option' => { + 'columns' => [ + 'optionnum', 'int', '', '', + 'exportnum', 'int', '', '', + 'optionname', 'varchar', '', $char_d, + 'optionvalue', 'text', 'NULL', '', + ], + 'primary_key' => 'optionnum', + 'unique' => [], + 'index' => [ [ 'exportnum' ], [ 'optionname' ] ], + }, + + 'radius_usergroup' => { + 'columns' => [ + 'usergroupnum', 'int', '', '', + 'svcnum', 'int', '', '', + 'groupname', 'varchar', '', $char_d, + ], + 'primary_key' => 'usergroupnum', + 'unique' => [], + 'index' => [ [ 'svcnum' ], [ 'groupname' ] ], + }, + + 'msgcat' => { + 'columns' => [ + 'msgnum', 'int', '', '', + 'msgcode', 'varchar', '', $char_d, + 'locale', 'varchar', '', 16, + 'msg', 'text', '', '', + ], + 'primary_key' => 'msgnum', + 'unique' => [ [ 'msgcode', 'locale' ] ], + 'index' => [], + }, + + 'cust_tax_exempt' => { + 'columns' => [ + 'exemptnum', 'int', '', '', + 'custnum', 'int', '', '', + 'taxnum', 'int', '', '', + 'year', 'int', '', '', + 'month', 'int', '', '', + 'amount', @money_type, + ], + 'primary_key' => 'exemptnum', + 'unique' => [ [ 'custnum', 'taxnum', 'year', 'month' ] ], + 'index' => [], + }, + + + + ); + + %tables; + +} + -- cgit v1.2.1 From ef92d87d1980598a4f786905ac7aff1af0ead2b8 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 25 Aug 2002 01:14:16 +0000 Subject: noninteractive freeside-setup --- FS/bin/freeside-setup | 77 ++++++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 35 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 21defa6e5..a14f0e12b 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -4,6 +4,8 @@ BEGIN { $FS::Record::setup_hack = 1; } use strict; +use vars qw($opt_s); +use Getopt::Std; use DBI; use DBIx::DBSchema 0.20; use DBIx::DBSchema::Table; @@ -21,6 +23,7 @@ die "Not running uid freeside!" unless checkeuid(); my %attrib2db = map { lc($FS::raddb::attrib{$_}) => $_ } keys %FS::raddb::attrib; +getopts("s"); my $user = shift or die &usage; getsecrets($user); @@ -33,42 +36,46 @@ my($dbdef_file) = "/usr/local/etc/freeside/dbdef.". datasrc; #my($username_len)=&getvalue; my $username_len = 32; #usernamemax config file -print "\n\n", <); - chop $x; - $x; -} +#print "\n\n", <); +# chop $x; +# $x; +#} +# +#sub _yesno { +# print " [y/N]:"; +# my $x = scalar(); +# $x =~ /^y/i; +#} -sub _yesno { - print " [y/N]:"; - my $x = scalar(); - $x =~ /^y/i; -} +my @check_attributes = (); #add later +my @attributes = (); #add later +my $ship = $opt_s; ### -- cgit v1.2.1 From 3dc9eeed220e7f7adbf08526f109a190deb3f552 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 25 Aug 2002 01:16:30 +0000 Subject: doc --- FS/bin/freeside-setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index a14f0e12b..78a03385c 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -320,10 +320,10 @@ foreach my $aref ( $dbh->commit or die $dbh->errstr; $dbh->disconnect or die $dbh->errstr; -print "Freeside database initialized sucessfully\n"; +#print "Freeside database initialized sucessfully\n"; sub usage { - die "Usage:\n fs-setup user\n"; + die "Usage:\n freeside-setup [ -s ] user\n"; } ### -- cgit v1.2.1 From eb0d04842631ae16247c6246cc6a1d8896169ff9 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 20 Sep 2002 12:50:30 +0000 Subject: move from bin/fs-setup to FS/bin/freeside-setup --- FS/bin/freeside-setup | 191 +++++++++++++++++++++++++++++--------------------- 1 file changed, 111 insertions(+), 80 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 78a03385c..cb74e64c8 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -138,33 +138,6 @@ foreach $attribute (@check_attributes) { )); } -##make part_svc table (but now as object) -# -#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_domain svc_forward svc_www)) { -# my($table)=$dbdef->table($_); -# my($col); -# foreach $col ( $table->columns ) { -# next if $col =~ /^svcnum$/; -# $part_svc->addcolumn( new DBIx::DBSchema::Column ( -# $table->name. '__' . $table->column($col)->name, -# 'varchar', #$table->column($col)->type, -# 'NULL', -# $char_d, #$table->column($col)->length, -# )); -# $part_svc->addcolumn ( new DBIx::DBSchema::Column ( -# $table->name. '__'. $table->column($col)->name . "_flag", -# 'char', -# 'NULL', -# 1, -# )); -# } -#} - #create history tables (false laziness w/create-history-tables) foreach my $table ( grep { ! /^h_/ } $dbdef->tables ) { my $tableobj = $dbdef->table($table) @@ -339,7 +312,7 @@ sub tables_hash_hack { 'agent' => { 'columns' => [ - 'agentnum', 'int', '', '', + 'agentnum', 'serial', '', '', 'agent', 'varchar', '', $char_d, 'typenum', 'int', '', '', 'freq', 'int', 'NULL', '', @@ -352,7 +325,7 @@ sub tables_hash_hack { 'agent_type' => { 'columns' => [ - 'typenum', 'int', '', '', + 'typenum', 'serial', '', '', 'atype', 'varchar', '', $char_d, ], 'primary_key' => 'typenum', @@ -372,7 +345,7 @@ sub tables_hash_hack { 'cust_bill' => { 'columns' => [ - 'invnum', 'int', '', '', + 'invnum', 'serial', '', '', 'custnum', 'int', '', '', '_date', @date_type, 'charged', @money_type, @@ -386,7 +359,7 @@ sub tables_hash_hack { 'cust_bill_event' => { 'columns' => [ - 'eventnum', 'int', '', '', + 'eventnum', 'serial', '', '', 'invnum', 'int', '', '', 'eventpart', 'int', '', '', '_date', @date_type, @@ -401,7 +374,7 @@ sub tables_hash_hack { 'part_bill_event' => { 'columns' => [ - 'eventpart', 'int', '', '', + 'eventpart', 'serial', '', '', 'payby', 'char', '', 4, 'event', 'varchar', '', $char_d, 'eventcode', @perl_type, @@ -432,11 +405,11 @@ sub tables_hash_hack { 'cust_credit' => { 'columns' => [ - 'crednum', 'int', '', '', + 'crednum', 'serial', '', '', 'custnum', 'int', '', '', '_date', @date_type, 'amount', @money_type, - 'otaker', 'varchar', '', 8, + 'otaker', 'varchar', '', 32, 'reason', 'text', 'NULL', '', 'closed', 'char', 'NULL', 1, ], @@ -447,7 +420,7 @@ sub tables_hash_hack { 'cust_credit_bill' => { 'columns' => [ - 'creditbillnum', 'int', '', '', + 'creditbillnum', 'serial', '', '', 'crednum', 'int', '', '', 'invnum', 'int', '', '', '_date', @date_type, @@ -460,7 +433,7 @@ sub tables_hash_hack { 'cust_main' => { 'columns' => [ - 'custnum', 'int', '', '', + 'custnum', 'serial', '', '', 'agentnum', 'int', '', '', # 'titlenum', 'int', 'NULL', '', 'last', 'varchar', '', $char_d, @@ -498,7 +471,7 @@ sub tables_hash_hack { 'paydate', 'varchar', 'NULL', 10, 'payname', 'varchar', 'NULL', $char_d, 'tax', 'char', 'NULL', 1, - 'otaker', 'varchar', '', 8, + 'otaker', 'varchar', '', 32, 'refnum', 'int', '', '', 'referral_custnum', 'int', 'NULL', '', 'comments', 'text', 'NULL', '', @@ -511,7 +484,7 @@ sub tables_hash_hack { 'cust_main_invoice' => { 'columns' => [ - 'destnum', 'int', '', '', + 'destnum', 'serial', '', '', 'custnum', 'int', '', '', 'dest', 'varchar', '', $char_d, ], @@ -524,7 +497,7 @@ sub tables_hash_hack { #cust_main_county for validation and to provide # a tax rate. 'columns' => [ - 'taxnum', 'int', '', '', + 'taxnum', 'serial', '', '', 'state', 'varchar', 'NULL', $char_d, 'county', 'varchar', 'NULL', $char_d, 'country', 'char', '', 2, @@ -540,7 +513,7 @@ sub tables_hash_hack { 'cust_pay' => { 'columns' => [ - 'paynum', 'int', '', '', + 'paynum', 'serial', '', '', #now cust_bill_pay #'invnum', 'int', '', '', 'custnum', 'int', '', '', 'paid', @money_type, @@ -558,7 +531,7 @@ sub tables_hash_hack { 'cust_bill_pay' => { 'columns' => [ - 'billpaynum', 'int', '', '', + 'billpaynum', 'serial', '', '', 'invnum', 'int', '', '', 'paynum', 'int', '', '', 'amount', @money_type, @@ -572,7 +545,7 @@ sub tables_hash_hack { 'cust_pay_batch' => { #what's this used for again? list of customers #in current CARD batch? (necessarily CARD?) 'columns' => [ - 'paybatchnum', 'int', '', '', + 'paybatchnum', 'serial', '', '', 'invnum', 'int', '', '', 'custnum', 'int', '', '', 'last', 'varchar', '', $char_d, @@ -597,10 +570,10 @@ sub tables_hash_hack { 'cust_pkg' => { 'columns' => [ - 'pkgnum', 'int', '', '', + 'pkgnum', 'serial', '', '', 'custnum', 'int', '', '', 'pkgpart', 'int', '', '', - 'otaker', 'varchar', '', 8, + 'otaker', 'varchar', '', 32, 'setup', @date_type, 'bill', @date_type, 'susp', @date_type, @@ -615,12 +588,12 @@ sub tables_hash_hack { 'cust_refund' => { 'columns' => [ - 'refundnum', 'int', '', '', + 'refundnum', 'serial', '', '', #now cust_credit_refund #'crednum', 'int', '', '', 'custnum', 'int', '', '', '_date', @date_type, 'refund', @money_type, - 'otaker', 'varchar', '', 8, + 'otaker', 'varchar', '', 32, 'reason', 'varchar', '', $char_d, 'payby', 'char', '', 4, # CARD/BILL/COMP, should be index # into payment type table. @@ -635,7 +608,7 @@ sub tables_hash_hack { 'cust_credit_refund' => { 'columns' => [ - 'creditrefundnum', 'int', '', '', + 'creditrefundnum', 'serial', '', '', 'crednum', 'int', '', '', 'refundnum', 'int', '', '', 'amount', @money_type, @@ -649,7 +622,7 @@ sub tables_hash_hack { 'cust_svc' => { 'columns' => [ - 'svcnum', 'int', '', '', + 'svcnum', 'serial', '', '', 'pkgnum', 'int', 'NULL', '', 'svcpart', 'int', '', '', ], @@ -660,7 +633,7 @@ sub tables_hash_hack { 'part_pkg' => { 'columns' => [ - 'pkgpart', 'int', '', '', + 'pkgpart', 'serial', '', '', 'pkg', 'varchar', '', $char_d, 'comment', 'varchar', '', $char_d, 'setup', @perl_type, @@ -701,7 +674,7 @@ sub tables_hash_hack { 'part_referral' => { 'columns' => [ - 'refnum', 'int', '', '', + 'refnum', 'serial', '', '', 'referral', 'varchar', '', $char_d, ], 'primary_key' => 'refnum', @@ -711,7 +684,7 @@ sub tables_hash_hack { 'part_svc' => { 'columns' => [ - 'svcpart', 'int', '', '', + 'svcpart', 'serial', '', '', 'svc', 'varchar', '', $char_d, 'svcdb', 'varchar', '', $char_d, 'disabled', 'char', 'NULL', 1, @@ -723,7 +696,7 @@ sub tables_hash_hack { 'part_svc_column' => { 'columns' => [ - 'columnnum', 'int', '', '', + 'columnnum', 'serial', '', '', 'svcpart', 'int', '', '', 'columnname', 'varchar', '', 64, 'columnvalue', 'varchar', 'NULL', $char_d, @@ -737,7 +710,7 @@ sub tables_hash_hack { #(this should be renamed to part_pop) 'svc_acct_pop' => { 'columns' => [ - 'popnum', 'int', '', '', + 'popnum', 'serial', '', '', 'city', 'varchar', '', $char_d, 'state', 'varchar', '', $char_d, 'ac', 'char', '', 3, @@ -751,7 +724,7 @@ sub tables_hash_hack { 'part_pop_local' => { 'columns' => [ - 'localnum', 'int', '', '', + 'localnum', 'serial', '', '', 'popnum', 'int', '', '', 'city', 'varchar', 'NULL', $char_d, 'state', 'char', 'NULL', 2, @@ -786,18 +759,6 @@ sub tables_hash_hack { 'index' => [ ['username'], ['domsvc'] ], }, -# 'svc_acct_sm' => { -# 'columns' => [ -# 'svcnum', 'int', '', '', -# 'domsvc', 'int', '', '', -# 'domuid', 'int', '', '', -# 'domuser', 'varchar', '', $char_d, -# ], -# 'primary_key' => 'svcnum', -# 'unique' => [ [] ], -# 'index' => [ ['domsvc'], ['domuid'] ], -# }, - #'svc_charge' => { # 'columns' => [ # 'svcnum', 'int', '', '', @@ -821,7 +782,7 @@ sub tables_hash_hack { 'domain_record' => { 'columns' => [ - 'recnum', 'int', '', '', + 'recnum', 'serial', '', '', 'svcnum', 'int', '', '', 'reczone', 'varchar', '', $char_d, 'recaf', 'char', '', 2, @@ -871,7 +832,7 @@ sub tables_hash_hack { 'prepay_credit' => { 'columns' => [ - 'prepaynum', 'int', '', '', + 'prepaynum', 'serial', '', '', 'identifier', 'varchar', '', $char_d, 'amount', @money_type, 'seconds', 'int', 'NULL', '', @@ -883,7 +844,7 @@ sub tables_hash_hack { 'port' => { 'columns' => [ - 'portnum', 'int', '', '', + 'portnum', 'serial', '', '', 'ip', 'varchar', 'NULL', 15, 'nasport', 'int', 'NULL', '', 'nasnum', 'int', '', '', @@ -895,7 +856,7 @@ sub tables_hash_hack { 'nas' => { 'columns' => [ - 'nasnum', 'int', '', '', + 'nasnum', 'serial', '', '', 'nas', 'varchar', '', $char_d, 'nasip', 'varchar', '', 15, 'nasfqdn', 'varchar', '', $char_d, @@ -908,7 +869,7 @@ sub tables_hash_hack { 'session' => { 'columns' => [ - 'sessionnum', 'int', '', '', + 'sessionnum', 'serial', '', '', 'portnum', 'int', '', '', 'svcnum', 'int', '', '', 'login', @date_type, @@ -921,7 +882,7 @@ sub tables_hash_hack { 'queue' => { 'columns' => [ - 'jobnum', 'int', '', '', + 'jobnum', 'serial', '', '', 'job', 'text', '', '', '_date', 'int', '', '', 'status', 'varchar', '', $char_d, @@ -935,7 +896,7 @@ sub tables_hash_hack { 'queue_arg' => { 'columns' => [ - 'argnum', 'int', '', '', + 'argnum', 'serial', '', '', 'jobnum', 'int', '', '', 'arg', 'text', 'NULL', '', ], @@ -946,7 +907,7 @@ sub tables_hash_hack { 'queue_depend' => { 'columns' => [ - 'dependnum', 'int', '', '', + 'dependnum', 'serial', '', '', 'jobnum', 'int', '', '', 'depend_jobnum', 'int', '', '', ], @@ -957,7 +918,7 @@ sub tables_hash_hack { 'export_svc' => { 'columns' => [ - 'exportsvcnum' => 'int', '', '', + 'exportsvcnum' => 'serial', '', '', 'exportnum' => 'int', '', '', 'svcpart' => 'int', '', '', ], @@ -968,7 +929,7 @@ sub tables_hash_hack { 'part_export' => { 'columns' => [ - 'exportnum', 'int', '', '', + 'exportnum', 'serial', '', '', #'svcpart', 'int', '', '', 'machine', 'varchar', '', $char_d, 'exporttype', 'varchar', '', $char_d, @@ -981,7 +942,7 @@ sub tables_hash_hack { 'part_export_option' => { 'columns' => [ - 'optionnum', 'int', '', '', + 'optionnum', 'serial', '', '', 'exportnum', 'int', '', '', 'optionname', 'varchar', '', $char_d, 'optionvalue', 'text', 'NULL', '', @@ -993,7 +954,7 @@ sub tables_hash_hack { 'radius_usergroup' => { 'columns' => [ - 'usergroupnum', 'int', '', '', + 'usergroupnum', 'serial', '', '', 'svcnum', 'int', '', '', 'groupname', 'varchar', '', $char_d, ], @@ -1004,7 +965,7 @@ sub tables_hash_hack { 'msgcat' => { 'columns' => [ - 'msgnum', 'int', '', '', + 'msgnum', 'serial', '', '', 'msgcode', 'varchar', '', $char_d, 'locale', 'varchar', '', 16, 'msg', 'text', '', '', @@ -1016,7 +977,7 @@ sub tables_hash_hack { 'cust_tax_exempt' => { 'columns' => [ - 'exemptnum', 'int', '', '', + 'exemptnum', 'serial', '', '', 'custnum', 'int', '', '', 'taxnum', 'int', '', '', 'year', 'int', '', '', @@ -1028,7 +989,77 @@ sub tables_hash_hack { 'index' => [], }, + 'ac_type' => { + 'columns' => [ + 'actypenum', 'serial', '', '', + 'actypename', 'varchar', '', $char_d, + ], + 'primary_key' => 'actypenum', + 'unique' => [], + 'index' => [], + }, + + 'ac' => { + 'columns' => [ + 'acnum', 'serial', '', '', + 'actypenum', 'int', '', '', + 'acname', 'varchar', '', $char_d, + ], + 'primary_key' => 'acnum', + 'unique' => [], + 'index' => [ [ 'actypenum' ] ], + }, + + 'part_ac_field' => { + 'columns' => [ + 'acfieldpart', 'serial', '', '', + 'actypenum', 'int', '', '', + 'name', 'varchar', '', $char_d, + 'ut_type', 'varchar', '', $char_d, + ], + 'primary_key' => 'acfieldpart', + 'unique' => [], + 'index' => [ [ 'actypenum' ] ], + }, + + 'ac_field' => { + 'columns' => [ + 'acfieldpart', 'int', '', '', + 'acnum', 'int', '', '', + 'value', 'text', '', '', + ], + 'primary_key' => '', + 'unique' => [ [ 'acfieldpart', 'acnum' ] ], + 'index' => [ [ 'acnum' ] ], + }, + + 'ac_block' => { + 'columns' => [ + 'acnum', 'int', '', '', + 'ip_gateway', 'varchar', '', 15, + 'ip_netmask', 'int', '', '', + ], + 'primary_key' => '', + 'unique' => [], + 'index' => [ [ 'acnum' ] ], + }, + 'svc_broadband' => { + 'columns' => [ + 'svcnum', 'int', '', '', + 'actypenum', 'int', '', '', + 'speed_up', 'int', '', '', + 'speed_down', 'int', '', '', + 'acnum', 'int', '', '', + 'ip_addr', 'varchar', '', 15, + 'ip_netmask', 'int', '', '', + 'mac_addr', 'char', '', 17, + 'location', 'varchar', '', $char_d, + ], + 'primary_key' => 'svcnum', + 'unique' => [], + 'index' => [ [ 'actypenum' ] ], + }, ); -- cgit v1.2.1 From 70a4b5227943108ce91c68e1c4e7509a9a6c33f9 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 20 Sep 2002 15:47:58 +0000 Subject: add freeside-deluser, freeside-deloutsource and freeside-deloutsourceuser --- FS/bin/freeside-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index cb74e64c8..e8bb7ec62 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -7,7 +7,7 @@ use strict; use vars qw($opt_s); use Getopt::Std; use DBI; -use DBIx::DBSchema 0.20; +use DBIx::DBSchema 0.21; use DBIx::DBSchema::Table; use DBIx::DBSchema::Column; use DBIx::DBSchema::ColGroup::Unique; -- cgit v1.2.1 From 8965012fa53fd05d851d2f5abed4e056ab758797 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 21 Sep 2002 11:17:39 +0000 Subject: all taxes now have names. closes: Bug#15 --- FS/bin/freeside-setup | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index e8bb7ec62..f6a543fc8 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -189,7 +189,23 @@ foreach my $table ( grep { ! /^h_/ } $dbdef->tables ) { 'default' => '', 'local' => '', } ), - map { $tableobj->column($_) } $tableobj->columns + map { + my $column = $tableobj->column($_); + + #clone so as to not disturb the original + $column = DBIx::DBSchema::Column->new( { + map { $_ => $column->$_() } + qw( name type null length default local ) + } ); + + $column->type('int') + if $column->type eq 'serial'; + #$column->default('') + # if $column->default =~ /^nextval\(/i; + #( my $local = $column->local ) =~ s/AUTO_INCREMENT//i; + #$column->local($local); + $column; + } $tableobj->columns ], } ); $dbdef->addtable($h_tableobj); @@ -397,9 +413,10 @@ sub tables_hash_hack { 'recur', @money_type, 'sdate', @date_type, 'edate', @date_type, + 'itemdesc', 'varchar', 'NULL', $char_d, ], 'primary_key' => '', - 'unique' => [ ['pkgnum', 'invnum'] ], + 'unique' => [], 'index' => [ ['invnum'] ], }, @@ -504,6 +521,7 @@ sub tables_hash_hack { 'taxclass', 'varchar', 'NULL', $char_d, 'exempt_amount', @money_type, 'tax', 'real', '', '', #tax % + 'taxname', 'varchar', 'NULL', $char_d, ], 'primary_key' => 'taxnum', 'unique' => [], -- cgit v1.2.1 From c4d2226e0cc4bdd6d9f689b061b5f4f5b9609b0b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Oct 2002 12:57:06 +0000 Subject: working on the road: - easier "change package" link for changing one package to another - sqlradius export now compatible with Pg - indices on phone numbers - install instructions specify Pg 7.1 (at least until ILIKE thing is changed) - searching on phone number fragments --- FS/bin/freeside-setup | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index f6a543fc8..d61e8b0bf 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -111,8 +111,9 @@ my($dbdef) = new DBIx::DBSchema ( map { my $cust_main = $dbdef->table('cust_main'); unless ($ship) { #remove ship_ from cust_main $cust_main->delcolumn($_) foreach ( grep /^ship_/, $cust_main->columns ); -} else { #add indices on ship_last and ship_company - push @{$cust_main->index->lol_ref}, ( ['ship_last'], ['ship_company'] ) +} else { #add indices + push @{$cust_main->index->lol_ref}, + map { [ "ship_$_" ] } qw( last company daytime night fax ); } #add radius attributes to svc_acct @@ -496,7 +497,9 @@ sub tables_hash_hack { 'primary_key' => 'custnum', 'unique' => [], #'index' => [ ['last'], ['company'] ], - 'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ] ], + 'index' => [ ['last'], [ 'company' ], [ 'referral_custnum' ], + [ 'daytime' ], [ 'night' ], [ 'fax' ], + ], }, 'cust_main_invoice' => { -- cgit v1.2.1 From 55bfcaa26d8cc7729a8fbaa3a5325e4372588e8b Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 19 Nov 2002 20:36:43 +0000 Subject: increase length of reczone and recdata fields in domain_record --- FS/bin/freeside-setup | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index d61e8b0bf..587f0158b 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -805,10 +805,12 @@ sub tables_hash_hack { 'columns' => [ 'recnum', 'serial', '', '', 'svcnum', 'int', '', '', - 'reczone', 'varchar', '', $char_d, + #'reczone', 'varchar', '', $char_d, + 'reczone', 'varchar', '', 255, 'recaf', 'char', '', 2, 'rectype', 'char', '', 5, - 'recdata', 'varchar', '', $char_d, + #'recdata', 'varchar', '', $char_d, + 'recdata', 'varchar', '', 255, ], 'primary_key' => 'recnum', 'unique' => [], -- cgit v1.2.1 From cfd4d4d5fd2c64f0f0512905a465aeb4abce484c Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 Nov 2002 09:07:27 +0000 Subject: ugh... need to increase length of payinfo field in cust_pay and cust_refund for ACH --- FS/bin/freeside-setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 587f0158b..8f3d99fd5 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -541,7 +541,7 @@ sub tables_hash_hack { '_date', @date_type, 'payby', 'char', '', 4, # CARD/BILL/COMP, should be index into # payment type table. - 'payinfo', 'varchar', 'NULL', 16, #see cust_main above + 'payinfo', 'varchar', 'NULL', $char_d, #see cust_main above 'paybatch', 'varchar', 'NULL', $char_d, #for auditing purposes. 'closed', 'char', 'NULL', 1, ], @@ -618,7 +618,7 @@ sub tables_hash_hack { 'reason', 'varchar', '', $char_d, 'payby', 'char', '', 4, # CARD/BILL/COMP, should be index # into payment type table. - 'payinfo', 'varchar', 'NULL', 16, #see cust_main above + 'payinfo', 'varchar', 'NULL', $char_d, #see cust_main above 'paybatch', 'varchar', 'NULL', $char_d, 'closed', 'char', 'NULL', 1, ], -- cgit v1.2.1 From b1d4c3b5b5a05d38a4baf9c49bd7fdfb6990531d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 24 Dec 2002 22:41:23 +0000 Subject: optimization for ginourmous numbers of packages for intergate, whew --- FS/bin/freeside-setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 8f3d99fd5..8b7466222 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -669,7 +669,7 @@ sub tables_hash_hack { ], 'primary_key' => 'pkgpart', 'unique' => [], - 'index' => [], + 'index' => [ [ disabled ], ], }, # 'part_title' => { @@ -712,7 +712,7 @@ sub tables_hash_hack { ], 'primary_key' => 'svcpart', 'unique' => [], - 'index' => [], + 'index' => [ [ 'disabled' ] ], }, 'part_svc_column' => { -- cgit v1.2.1 From 39b71146259e7c2eab3b0c3326000087a7dd75b1 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 28 Jan 2003 07:47:52 +0000 Subject: eek, and this is what caused connectup to fail too --- FS/bin/freeside-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 8b7466222..0ef3fc81b 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -669,7 +669,7 @@ sub tables_hash_hack { ], 'primary_key' => 'pkgpart', 'unique' => [], - 'index' => [ [ disabled ], ], + 'index' => [ [ 'disabled' ], ], }, # 'part_title' => { -- cgit v1.2.1 From 0354f39ed0e74fd2eae1d9da13906625b4f56591 Mon Sep 17 00:00:00 2001 From: khoff Date: Wed, 5 Feb 2003 23:17:17 +0000 Subject: svc_broadband rewrite --- FS/bin/freeside-setup | 89 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 33 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 0ef3fc81b..19483765e 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -1012,76 +1012,99 @@ sub tables_hash_hack { 'index' => [], }, - 'ac_type' => { + 'router' => { 'columns' => [ - 'actypenum', 'serial', '', '', - 'actypename', 'varchar', '', $char_d, + 'routernum', 'serial', '', '', + 'routername', 'varchar', '', $char_d, + 'svcnum', 'int', '0', '', ], - 'primary_key' => 'actypenum', + 'primary_key' => 'routernum', 'unique' => [], 'index' => [], }, - 'ac' => { + 'part_svc_router' => { 'columns' => [ - 'acnum', 'serial', '', '', - 'actypenum', 'int', '', '', - 'acname', 'varchar', '', $char_d, - ], - 'primary_key' => 'acnum', + 'svcpart', 'int', '', '', + 'routernum', 'int', '', '', + ]; + 'primary_key' => '', 'unique' => [], - 'index' => [ [ 'actypenum' ] ], + 'index' => [], }, - 'part_ac_field' => { + 'part_router_field' => { 'columns' => [ - 'acfieldpart', 'serial', '', '', - 'actypenum', 'int', '', '', + 'routerfieldpart', 'serial', '', '', 'name', 'varchar', '', $char_d, - 'ut_type', 'varchar', '', $char_d, + 'length', 'int', '', '', + 'check_block', 'text', 'NULL', '', + 'list_source', 'text', 'NULL', '', ], - 'primary_key' => 'acfieldpart', + 'primary_key' => 'routerfieldpart', 'unique' => [], - 'index' => [ [ 'actypenum' ] ], + 'index' => [], }, - 'ac_field' => { + 'router_field' => { 'columns' => [ - 'acfieldpart', 'int', '', '', - 'acnum', 'int', '', '', - 'value', 'text', '', '', + 'routerfieldpart', 'int', '', '', + 'routernum', 'int', '', '', + 'value', 'varchar', '', 128, ], 'primary_key' => '', - 'unique' => [ [ 'acfieldpart', 'acnum' ] ], - 'index' => [ [ 'acnum' ] ], + 'unique' => [ [ 'routerfieldpart', 'routernum' ] ], + 'index' => [], }, - 'ac_block' => { + 'addr_block' => { 'columns' => [ - 'acnum', 'int', '', '', + 'blocknum', 'int', '', '', + 'routernum', 'int', '', '', 'ip_gateway', 'varchar', '', 15, 'ip_netmask', 'int', '', '', ], + 'primary_key' => 'blocknum', + 'unique' => [ [ 'blocknum', 'routernum' ] ], + 'index' => [], + }, + + 'part_sb_field' => { + 'columns' => [ + 'sbfieldpart', 'int', '', '', + 'svcpart', 'int', '', '', + 'name', 'varchar', '', $char_d, + 'length', 'int', '', '', + 'check_block', 'text', 'NULL', '', + 'list_source', 'text', 'NULL', '', + ], + 'primary_key' => 'sbfieldpart', + 'unique' => [ [ 'sbfieldpart', 'svcpart' ] ], + 'index' => [], + }, + + 'sb_field' => { + 'columns' => [ + 'sbfieldpart', 'int', '', '', + 'svcnum', 'int', '', '', + 'value', 'varchar', '', 128, + ], 'primary_key' => '', - 'unique' => [], - 'index' => [ [ 'acnum' ] ], + 'unique' => [ [ 'sbfieldpart', 'svcnum' ] ], + 'index' => [], }, 'svc_broadband' => { 'columns' => [ 'svcnum', 'int', '', '', - 'actypenum', 'int', '', '', + 'blocknum', 'int', '', '', 'speed_up', 'int', '', '', 'speed_down', 'int', '', '', - 'acnum', 'int', '', '', 'ip_addr', 'varchar', '', 15, - 'ip_netmask', 'int', '', '', - 'mac_addr', 'char', '', 17, - 'location', 'varchar', '', $char_d, ], 'primary_key' => 'svcnum', 'unique' => [], - 'index' => [ [ 'actypenum' ] ], + 'index' => [], }, ); -- cgit v1.2.1 From c232fac0743999105f6948b9fa352fe2293b09f8 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 6 Feb 2003 05:26:50 +0000 Subject: time/data detail on invoices --- FS/bin/freeside-setup | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 19483765e..cf009c249 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -421,6 +421,18 @@ sub tables_hash_hack { 'index' => [ ['invnum'] ], }, + 'cust_bill_pkg_detail' => { + 'columns' => [ + 'detailnum', 'serial', '', '', + 'pkgnum', 'int', '', '', + 'invnum', 'int', '', '', + 'detail', 'varchar', '', $char_d, + ], + 'primary_key' => 'detailnum', + 'unique' => [], + 'index' => [ [ 'pkgnum', 'invnum' ] ], + }, + 'cust_credit' => { 'columns' => [ 'crednum', 'serial', '', '', -- cgit v1.2.1 From 2fc87c32cbb509992070b044ed66e2a0e9828a17 Mon Sep 17 00:00:00 2001 From: khoff Date: Wed, 12 Feb 2003 01:21:50 +0000 Subject: s/;/,/ --- FS/bin/freeside-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index cf009c249..b3cdb3384 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -1039,7 +1039,7 @@ sub tables_hash_hack { 'columns' => [ 'svcpart', 'int', '', '', 'routernum', 'int', '', '', - ]; + ], 'primary_key' => '', 'unique' => [], 'index' => [], -- cgit v1.2.1 From f9dbf311aeddb4356855362d586d1c4643b4f538 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 31 Mar 2003 23:48:31 +0000 Subject: add 'last_bill' column --- FS/bin/freeside-setup | 1 + 1 file changed, 1 insertion(+) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index b3cdb3384..010ec4c14 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -609,6 +609,7 @@ sub tables_hash_hack { 'otaker', 'varchar', '', 32, 'setup', @date_type, 'bill', @date_type, + 'last_bill', @date_type, 'susp', @date_type, 'cancel', @date_type, 'expire', @date_type, -- cgit v1.2.1 From 030bef17868168b05a67d9f5866b55da1bb9439c Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 21 Apr 2003 20:53:57 +0000 Subject: on-demand vs. automatic cards & checks: added DCRD and DCHK payment types --- FS/bin/freeside-setup | 2 ++ 1 file changed, 2 insertions(+) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 010ec4c14..8ec014186 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -291,6 +291,8 @@ foreach my $aref ( [ 'COMP', 'Comp invoice', '$cust_bill->comp();', 30, 'comp' ], [ 'CARD', 'Batch card', '$cust_bill->batch_card();', 40, 'batch-card' ], [ 'BILL', 'Send invoice', '$cust_bill->send();', 50, 'send' ], + [ 'DCRD', 'Send invoice', '$cust_bill->send();', 50, 'send' ], + [ 'DCHK', 'Send invoice', '$cust_bill->send();', 50, 'send' ], ) { my $part_bill_event = new FS::part_bill_event({ -- cgit v1.2.1 From 970a86aec45df2ab579ac54fc67cba475c7c013b Mon Sep 17 00:00:00 2001 From: khoff Date: Wed, 23 Apr 2003 04:53:17 +0000 Subject: DBD::Pg doesn't handle char types very well. --- FS/bin/freeside-setup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 8ec014186..518a2ad42 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -471,7 +471,7 @@ sub tables_hash_hack { 'last', 'varchar', '', $char_d, # 'middle', 'varchar', 'NULL', $char_d, 'first', 'varchar', '', $char_d, - 'ss', 'char', 'NULL', 11, + 'ss', 'varchar', 'NULL', 11, 'company', 'varchar', 'NULL', $char_d, 'address1', 'varchar', '', $char_d, 'address2', 'varchar', 'NULL', $char_d, @@ -823,7 +823,7 @@ sub tables_hash_hack { #'reczone', 'varchar', '', $char_d, 'reczone', 'varchar', '', 255, 'recaf', 'char', '', 2, - 'rectype', 'char', '', 5, + 'rectype', 'varchar', '', 5, #'recdata', 'varchar', '', $char_d, 'recdata', 'varchar', '', 255, ], -- cgit v1.2.1 From b5e03a09e99ede045b0e3be87085c628d422e3ea Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Jun 2003 05:49:16 +0000 Subject: router.svcnum nullability fix --- FS/bin/freeside-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 518a2ad42..a1fab5fa0 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -1031,7 +1031,7 @@ sub tables_hash_hack { 'columns' => [ 'routernum', 'serial', '', '', 'routername', 'varchar', '', $char_d, - 'svcnum', 'int', '0', '', + 'svcnum', 'int', 'NULL', '', ], 'primary_key' => 'routernum', 'unique' => [], -- cgit v1.2.1 From a60b96753d5c615914fa766b2b0fe8bd2f86c337 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Jun 2003 06:09:52 +0000 Subject: use serial for primary keys in new tables too --- FS/bin/freeside-setup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index a1fab5fa0..d2a98dd0c 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -1031,7 +1031,7 @@ sub tables_hash_hack { 'columns' => [ 'routernum', 'serial', '', '', 'routername', 'varchar', '', $char_d, - 'svcnum', 'int', 'NULL', '', + 'svcnum', 'int', '0', '', ], 'primary_key' => 'routernum', 'unique' => [], @@ -1074,7 +1074,7 @@ sub tables_hash_hack { 'addr_block' => { 'columns' => [ - 'blocknum', 'int', '', '', + 'blocknum', 'serial', '', '', 'routernum', 'int', '', '', 'ip_gateway', 'varchar', '', 15, 'ip_netmask', 'int', '', '', @@ -1086,7 +1086,7 @@ sub tables_hash_hack { 'part_sb_field' => { 'columns' => [ - 'sbfieldpart', 'int', '', '', + 'sbfieldpart', 'serial', '', '', 'svcpart', 'int', '', '', 'name', 'varchar', '', $char_d, 'length', 'int', '', '', -- cgit v1.2.1 From 9e6413e476a3516a08710efa5ff4d5949c1aa88c Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 14 Jun 2003 02:02:55 +0000 Subject: add index on cust_bill._date --- FS/bin/freeside-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index d2a98dd0c..734744efe 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -373,7 +373,7 @@ sub tables_hash_hack { ], 'primary_key' => 'invnum', 'unique' => [], - 'index' => [ ['custnum'] ], + 'index' => [ ['custnum'], ['_date'] ], }, 'cust_bill_event' => { -- cgit v1.2.1 From 58d44fbe5eb9ab32e6d87063a4a3b22ddba9a828 Mon Sep 17 00:00:00 2001 From: khoff Date: Tue, 5 Aug 2003 00:20:51 +0000 Subject: Virtual field merge --- FS/bin/freeside-setup | 77 ++++++++++++++++++--------------------------------- 1 file changed, 27 insertions(+), 50 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 734744efe..2cb555e18 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -1031,7 +1031,7 @@ sub tables_hash_hack { 'columns' => [ 'routernum', 'serial', '', '', 'routername', 'varchar', '', $char_d, - 'svcnum', 'int', '0', '', + 'svcnum', 'int', 'NULL', '', ], 'primary_key' => 'routernum', 'unique' => [], @@ -1048,30 +1048,6 @@ sub tables_hash_hack { 'index' => [], }, - 'part_router_field' => { - 'columns' => [ - 'routerfieldpart', 'serial', '', '', - 'name', 'varchar', '', $char_d, - 'length', 'int', '', '', - 'check_block', 'text', 'NULL', '', - 'list_source', 'text', 'NULL', '', - ], - 'primary_key' => 'routerfieldpart', - 'unique' => [], - 'index' => [], - }, - - 'router_field' => { - 'columns' => [ - 'routerfieldpart', 'int', '', '', - 'routernum', 'int', '', '', - 'value', 'varchar', '', 128, - ], - 'primary_key' => '', - 'unique' => [ [ 'routerfieldpart', 'routernum' ] ], - 'index' => [], - }, - 'addr_block' => { 'columns' => [ 'blocknum', 'serial', '', '', @@ -1084,31 +1060,6 @@ sub tables_hash_hack { 'index' => [], }, - 'part_sb_field' => { - 'columns' => [ - 'sbfieldpart', 'serial', '', '', - 'svcpart', 'int', '', '', - 'name', 'varchar', '', $char_d, - 'length', 'int', '', '', - 'check_block', 'text', 'NULL', '', - 'list_source', 'text', 'NULL', '', - ], - 'primary_key' => 'sbfieldpart', - 'unique' => [ [ 'sbfieldpart', 'svcpart' ] ], - 'index' => [], - }, - - 'sb_field' => { - 'columns' => [ - 'sbfieldpart', 'int', '', '', - 'svcnum', 'int', '', '', - 'value', 'varchar', '', 128, - ], - 'primary_key' => '', - 'unique' => [ [ 'sbfieldpart', 'svcnum' ] ], - 'index' => [], - }, - 'svc_broadband' => { 'columns' => [ 'svcnum', 'int', '', '', @@ -1122,6 +1073,32 @@ sub tables_hash_hack { 'index' => [], }, + 'part_virtual_field' => { + 'columns' => [ + 'vfieldpart', 'int', '', '', + 'dbtable', 'varchar', '', 32, + 'name', 'varchar', '', 32, + 'check_block', 'text', 'NULL', '', + 'length', 'int', 'NULL', '', + 'list_source', 'text', 'NULL', '', + 'label', 'varchar', 'NULL', 80, + ], + 'primary_key' => 'vfieldpart', + 'unique' => [], + 'index' => [], + }, + + 'virtual_field' => { + 'columns' => [ + 'recnum', 'int', '', '', + 'vfieldpart', 'int', '', '', + 'value', 'varchar', '', 128, + ], + 'primary_key' => '', + 'unique' => [ [ 'vfieldpart', 'recnum' ] ], + 'index' => [], + }, + ); %tables; -- cgit v1.2.1 From 26ff2b45ce893fa83baffc60dea898df887e7b1d Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 5 Sep 2003 07:55:38 +0000 Subject: svc_acct._password from 50 to 72 for blowfish passwords --- FS/bin/freeside-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 2cb555e18..197542086 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -776,7 +776,7 @@ sub tables_hash_hack { 'columns' => [ 'svcnum', 'int', '', '', 'username', 'varchar', '', $username_len, #unique (& remove dup code) - '_password', 'varchar', '', 50, #13 for encryped pw's plus ' *SUSPENDED* (mp5 passwords can be 34) + '_password', 'varchar', '', 72, #13 for encryped pw's plus ' *SUSPENDED* (md5 passwords can be 34, blowfish 60) 'sec_phrase', 'varchar', 'NULL', $char_d, 'popnum', 'int', 'NULL', '', 'uid', 'int', 'NULL', '', -- cgit v1.2.1 From d6436c7251a94c9597c7b2195d63bd7c86f956e9 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 25 Sep 2003 10:42:28 +0000 Subject: add setuptax and recurtax fields to cust_main_county --- FS/bin/freeside-setup | 2 ++ 1 file changed, 2 insertions(+) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 197542086..27d02529c 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -539,6 +539,8 @@ sub tables_hash_hack { 'exempt_amount', @money_type, 'tax', 'real', '', '', #tax % 'taxname', 'varchar', 'NULL', $char_d, + 'setuptax', 'char', 'NULL', 1, # Y = setup tax exempt + 'recurtax', 'char', 'NULL', 1, # Y = recur tax exempt ], 'primary_key' => 'taxnum', 'unique' => [], -- cgit v1.2.1 From e17e58178d528e16d45c333996f763afda55e054 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 29 Sep 2003 05:51:20 +0000 Subject: added agent.disabled agent.username agent._password --- FS/bin/freeside-setup | 3 +++ 1 file changed, 3 insertions(+) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 27d02529c..bb122700a 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -336,6 +336,9 @@ sub tables_hash_hack { 'typenum', 'int', '', '', 'freq', 'int', 'NULL', '', 'prog', @perl_type, + 'disabled', 'char', 'NULL', 1, + 'username', 'varchar', '', $char_d, + '_password','varchar', '', $char_d, ], 'primary_key' => 'agentnum', 'unique' => [], -- cgit v1.2.1 From 7598ece6cac31548505dd610ef418ca001adf5b2 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 15 Oct 2003 12:08:47 +0000 Subject: fix agent username and password nullability --- FS/bin/freeside-setup | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index bb122700a..b7b45dc63 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -337,8 +337,8 @@ sub tables_hash_hack { 'freq', 'int', 'NULL', '', 'prog', @perl_type, 'disabled', 'char', 'NULL', 1, - 'username', 'varchar', '', $char_d, - '_password','varchar', '', $char_d, + 'username', 'varchar', 'NULL', $char_d, + '_password','varchar', 'NULL', $char_d, ], 'primary_key' => 'agentnum', 'unique' => [], @@ -1104,6 +1104,20 @@ sub tables_hash_hack { 'index' => [], }, + 'acct_snarf' => { + 'columns' => [ + 'snarfnum', 'int', '', '', + 'svcnum', 'int', '', '', + 'machine', 'varchar', '', 255, + 'protocol', 'varchar', '', $char_d, + 'username', 'varchar', '', $char_d, + '_password', 'varchar', '', $char_d, + ], + 'primary_key' => 'snarfnum', + 'unique' => [], + 'index' => [ [ 'svcnum' ] ], + }, + ); %tables; -- cgit v1.2.1 From ea1d9968a9439272b58593e6b2ccbb3869002b20 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 20 Oct 2003 04:25:18 +0000 Subject: daily/weekly billing --- FS/bin/freeside-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index b7b45dc63..375a63c2f 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -678,7 +678,7 @@ sub tables_hash_hack { 'pkg', 'varchar', '', $char_d, 'comment', 'varchar', '', $char_d, 'setup', @perl_type, - 'freq', 'int', '', '', #billing frequency (months) + 'freq', 'varchar', '', $char_d, #billing frequency 'recur', @perl_type, 'setuptax', 'char', 'NULL', 1, 'recurtax', 'char', 'NULL', 1, -- cgit v1.2.1 From f63c0e821610c885f9f49d301eeccf804e1ca6d3 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 24 Oct 2003 19:30:44 +0000 Subject: cvv! --- FS/bin/freeside-setup | 1 + 1 file changed, 1 insertion(+) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 375a63c2f..80b74c1f1 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -502,6 +502,7 @@ sub tables_hash_hack { 'ship_fax', 'varchar', 'NULL', 12, 'payby', 'char', '', 4, 'payinfo', 'varchar', 'NULL', $char_d, + 'paycvv', 'varchar', 'NULL', 4, #'paydate', @date_type, 'paydate', 'varchar', 'NULL', 10, 'payname', 'varchar', 'NULL', $char_d, -- cgit v1.2.1 From a5bc5bcbadafe55b31d9e97fccb6122477e390fb Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 10 Dec 2003 22:51:06 +0000 Subject: add part_referral.disabled, add disabled indices to agent and part_bill_event --- FS/bin/freeside-setup | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 80b74c1f1..4e3a09aad 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -342,7 +342,7 @@ sub tables_hash_hack { ], 'primary_key' => 'agentnum', 'unique' => [], - 'index' => [ ['typenum'] ], + 'index' => [ ['typenum'], ['diabled'] ], }, 'agent_type' => { @@ -408,7 +408,7 @@ sub tables_hash_hack { ], 'primary_key' => 'eventpart', 'unique' => [], - 'index' => [ ['payby'] ], + 'index' => [ ['payby'], ['disabled'], ], }, 'cust_bill_pkg' => { @@ -567,7 +567,7 @@ sub tables_hash_hack { ], 'primary_key' => 'paynum', 'unique' => [], - 'index' => [ [ 'custnum' ], [ 'paybatch' ] ], + 'index' => [ [ 'custnum' ], [ 'paybatch' ], [ 'payby' ], [ '_date' ] ], }, 'cust_bill_pay' => { @@ -718,10 +718,11 @@ sub tables_hash_hack { 'columns' => [ 'refnum', 'serial', '', '', 'referral', 'varchar', '', $char_d, + 'disabled', 'char', 'NULL', 1, ], 'primary_key' => 'refnum', 'unique' => [], - 'index' => [], + 'index' => [ ['disabled'] ], }, 'part_svc' => { -- cgit v1.2.1 From d20581bcbf2809d5c2969d773b16a0c8714a6dec Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 23 Dec 2003 01:49:32 +0000 Subject: add svc_external --- FS/bin/freeside-setup | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 4e3a09aad..fce8bc750 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -1120,6 +1120,17 @@ sub tables_hash_hack { 'index' => [ [ 'svcnum' ] ], }, + 'svc_external' => { + 'columns' => [ + 'svcnum', 'int', '', '', + 'id', 'int', '', '', + 'title', 'varchar', 'NULL', $char_d, + ], + 'primary_key' => 'svcnum', + 'unique' => [], + 'index' => [], + }, + ); %tables; -- cgit v1.2.1 From 9617ce4b230c7dc56b4fa4a50d805ddaef87d090 Mon Sep 17 00:00:00 2001 From: khoff Date: Wed, 24 Dec 2003 18:18:21 +0000 Subject: tyop --- FS/bin/freeside-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index fce8bc750..b7a414ae2 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -342,7 +342,7 @@ sub tables_hash_hack { ], 'primary_key' => 'agentnum', 'unique' => [], - 'index' => [ ['typenum'], ['diabled'] ], + 'index' => [ ['typenum'], ['disabled'] ], }, 'agent_type' => { -- cgit v1.2.1 From c7e637f35948396ca2bf760160f2a1a3081e0484 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 31 Jan 2004 06:33:40 +0000 Subject: add pkg_svc.primary_svc flag to enable an explicit first package flag --- FS/bin/freeside-setup | 1 + 1 file changed, 1 insertion(+) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index b7a414ae2..72780e363 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -708,6 +708,7 @@ sub tables_hash_hack { 'pkgpart', 'int', '', '', 'svcpart', 'int', '', '', 'quantity', 'int', '', '', + 'primary_svc','char', 'NULL', 1, ], 'primary_key' => '', 'unique' => [ ['pkgpart', 'svcpart'] ], -- cgit v1.2.1 From 07930a9141f823787a7e9c1e88fef453eb850fc7 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 13 Feb 2004 10:35:42 +0000 Subject: add svc_forward.src --- FS/bin/freeside-setup | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index 72780e363..feebcf9f7 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -844,8 +844,9 @@ sub tables_hash_hack { 'columns' => [ 'svcnum', 'int', '', '', 'srcsvc', 'int', '', '', + 'src', 'varchar', 'NULL', 255, 'dstsvc', 'int', '', '', - 'dst', 'varchar', 'NULL', $char_d, + 'dst', 'varchar', 'NULL', 255, ], 'primary_key' => 'svcnum', 'unique' => [], -- cgit v1.2.1 From 1e2a5c920840e046e4e28ca35681cb0912322666 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 13 Feb 2004 10:57:55 +0000 Subject: continue adding svc_forward.src: make svc_forward.srcsvc nullable --- FS/bin/freeside-setup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'FS/bin/freeside-setup') diff --git a/FS/bin/freeside-setup b/FS/bin/freeside-setup index feebcf9f7..7512cc18c 100755 --- a/FS/bin/freeside-setup +++ b/FS/bin/freeside-setup @@ -842,10 +842,10 @@ sub tables_hash_hack { 'svc_forward' => { 'columns' => [ - 'svcnum', 'int', '', '', - 'srcsvc', 'int', '', '', + 'svcnum', 'int', '', '', + 'srcsvc', 'int', 'NULL', '', 'src', 'varchar', 'NULL', 255, - 'dstsvc', 'int', '', '', + 'dstsvc', 'int', 'NULL', '', 'dst', 'varchar', 'NULL', 255, ], 'primary_key' => 'svcnum', -- cgit v1.2.1