use FS::UID qw(adminsuidsetup checkeuid datasrc ); #getsecrets);
use FS::CurrentUser;
use FS::Schema qw( dbdef dbdef_dist reload_dbdef );
+use FS::Misc::prune qw(prune_applications);
die "Not running uid freeside!" unless checkeuid();
my $user = shift or die &usage;
$FS::CurrentUser::upgrade_hack = 1;
+$FS::UID::callback_hack = 1;
my $dbh = adminsuidsetup($user);
+$FS::UID::callback_hack = 0;
#needs to match FS::Schema...
my $dbdef_file = "%%%FREESIDE_CONF%%%/dbdef.". datasrc;
dbdef->update_schema( dbdef_dist, $dbh );
}
+my $hashref = {};
+$hashref->{dry_run} = 1 if $DRY_RUN;
+$hashref->{debug} = 1 if $DEBUG;
+print join "\n", prune_applications($hashref);
+print "\n" if $DRY_RUN;
+
+
$dbh->commit or die $dbh->errstr;
dbdef_create($dbh, $dbdef_file);
$dbh->disconnect or die $dbh->errstr;
+unless ( $DRY_RUN ) {
+ my $init_config = "freeside-init-config -u $user ";
+ $init_config .= "%%%FREESIDE_CONF%%%/conf.". datasrc;
+ system "$init_config" ;
+}
+
###
sub dbdef_create { # reverse engineer the schema from the DB and save to file
=head1 SYNOPSIS
- freeside-adduser [ -d ] [ -q | -v ]
+ freeside-upgrade [ -d ] [ -q | -v ]
=head1 DESCRIPTION