StoryArchive optional sorting by title.

Fwiw, this code was written a while ago but seems to have gotten
misplaced.
This commit is contained in:
Scott Walters 2010-07-23 09:13:55 -04:00
parent 031309a1aa
commit d17d096380
4 changed files with 127 additions and 8 deletions

View file

@ -32,10 +32,10 @@ my $session = start(); # this line required
# upgrade functions go here
addSpamStopWordsToConfig($session);
alterStoryArchiveTable($session);
finish($session); # this line required
#----------------------------------------------------------------------------
# Describe what our function does
#sub exampleFunction {
@ -56,6 +56,25 @@ sub addSpamStopWordsToConfig {
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Describe what our function does
sub alterStoryArchiveTable {
my $session = shift;
print "\tAdd story sort order column to the StoryAcrhive table... " unless $quiet;
my $sth = $session->db->read('DESCRIBE `StoryArchive`');
while (my ($col) = $sth->array) {
if ($col eq 'storySortOrder') {
print "Skipped.\n" unless $quiet;
return;
}
}
$session->db->write("ALTER TABLE StoryArchive ADD COLUMN storySortOrder CHAR(22)");
print "DONE!\n" unless $quiet;
}
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
#----------------------------------------------------------------------------