Renaming mailing tables to better names.

This commit is contained in:
Martin Kamerbeek 2010-06-03 12:10:07 +02:00
parent da2ea4d62b
commit a1d8ab6f70
4 changed files with 16 additions and 5 deletions

View file

@ -34,7 +34,6 @@ renamespaceTemplates( $session );
finish($session);
#----------------------------------------------------------------------------
sub installMailableAspectTable {
my $session = shift;
@ -152,8 +151,20 @@ sub addRecentColumnToNewsletterCollection {
#----------------------------------------------------------------------------
sub installMailingTables {
my $session = shift;
my $db = $session->db;
print "\tInstalling Mailing table...";
# Remname tables from a previous (bad) name to a new (good) one.
# Must be done before the crudCreateOrUpdate calls to prevent creation of stale tables.
my @tables = $db->buildArray( 'show tables' );
if ( grep { $_ eq 'WGMailing' } @tables ) {
$db->write( 'rename table WGMailing to Mailing' );
}
if ( grep { $_ eq 'WGMailing_queue' } @tables ) {
$db->write( 'rename table WGMailing_queue to Mailing_email' );
}
# Create or update Mailing tables.
use WebGUI::Mailing;
use WebGUI::Mailing::Email;