[freeside-commits] freeside/FS/FS TicketSystem.pm, 1.10, 1.10.2.1 Upgrade.pm, 1.52, 1.52.2.1
Mark Wells
mark at wavetail.420.am
Tue Aug 23 14:46:35 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv19603/FS/FS
Modified Files:
Tag: FREESIDE_2_3_BRANCH
TicketSystem.pm Upgrade.pm
Log Message:
RT future ticket resolve, #13853
Index: TicketSystem.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/TicketSystem.pm,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -w -d -r1.10 -r1.10.2.1
--- TicketSystem.pm 16 Jul 2011 02:47:19 -0000 1.10
+++ TicketSystem.pm 23 Aug 2011 21:46:33 -0000 1.10.2.1
@@ -4,6 +4,7 @@
use vars qw( $conf $system $AUTOLOAD );
use FS::Conf;
use FS::UID qw( dbh driver_name );
+use FS::Record qw( dbdef );
FS::UID->install_callback( sub {
$conf = new FS::Conf;
@@ -27,6 +28,54 @@
$self->$sub(@_);
}
+# Our schema changes
+my %columns = (
+ Tickets => {
+ WillResolve => { type => 'timestamp', null => 1, default => '', },
+ },
+ CustomFields => {
+ Required => { type => 'integer', default => 0, null => 0 },
+ },
+);
+
+sub _upgrade_schema {
+ my $system = FS::Conf->new->config('ticket_system');
+ return if !defined($system) || $system ne 'RT_Internal';
+ my ($class, %opts) = @_;
+
+ my $dbh = dbh;
+ my @sql;
+ my $case = driver_name eq 'mysql' ? sub {@_} : sub {map lc, @_};
+ foreach my $tablename (keys %columns) {
+ my $table = dbdef->table(&$case($tablename));
+ if ( !$table ) {
+ warn
+ "$tablename table does not exist. Your RT installation is incomplete.\n";
+ next;
+ }
+ foreach my $colname (keys %{ $columns{$tablename} }) {
+ if ( !$table->column(&$case($colname)) ) {
+ my $col = new DBIx::DBSchema::Column {
+ table_obj => $table,
+ name => &$case($colname),
+ %{ $columns{$tablename}->{$colname} }
+ };
+ $col->table_obj($table);
+ push @sql, $col->sql_add_column($dbh);
+ }
+ } #foreach $colname
+ } #foreach $tablename
+
+ return if !@sql;
+ warn "Upgrading RT schema:\n";
+ foreach my $statement (@sql) {
+ warn "$statement\n";
+ $dbh->do( $statement )
+ or die "Error: ". $dbh->errstr. "\n executing: $statement";
+ }
+ return;
+}
+
sub _upgrade_data {
return if !defined($system) || $system ne 'RT_Internal';
my ($class, %opts) = @_;
Index: Upgrade.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Upgrade.pm,v
retrieving revision 1.52
retrieving revision 1.52.2.1
diff -u -w -d -r1.52 -r1.52.2.1
--- Upgrade.pm 21 Jul 2011 03:42:55 -0000 1.52
+++ Upgrade.pm 23 Aug 2011 21:46:33 -0000 1.52.2.1
@@ -303,6 +303,8 @@
#fix classnum character(1)
'cust_bill_pkg_detail' => [],
+ #add necessary columns to RT schema
+ 'TicketSystem' => [],
;
More information about the freeside-commits
mailing list