Changeset 319


Ignore:
Timestamp:
Jun 2, 2006, 7:40:31 PM (13 years ago)
Author:
Dominic Hargreaves
Message:

Check that we can do all we need to when upgrading MySQL database (closes #8)

Location:
wiki-toolkit/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wiki-toolkit/trunk/Changes

    r317 r319  
    110.69_04
    2         Feed code being refactored.
     2        Feed code has been refactored.
    33        Check that the database schema is up-to-date when initializing the
    4         store and abort otherwise.
     4          store and abort otherwise.
    55        In PostgresSQL setup code, delete orphaned content/metadata rows.
     6        When we bulk delete and insert data for an upgrade, check to make
     7          sure we can create the tables and indexes before dropping the old
     8          tables.
    69
    7100.69_03 13 May 2006
    811        Add Wiki::Toolkit::Feed::RSS (formerly CGI::Wiki::Plugin::RSS::Modwiki)
    9         and Wiki::Toolkit::Feed::Atom (formerly CGI::Wiki::Plugin::Atom)
     12          and Wiki::Toolkit::Feed::Atom (formerly CGI::Wiki::Plugin::Atom)
    1013
    11140.69_02 27 April 2006
    1215        Add missing new file lib/Wiki/Toolkit/Setup/Database.pm to
    13         distribution.
     16          distribution.
    1417
    15180.69_01 23 April 2006
  • wiki-toolkit/trunk/lib/Wiki/Toolkit/Setup/Database.pm

    r290 r319  
    254254    print "done\n";
    255255}
     256
     257sub perm_check {
     258    my $dbh = shift;
     259    # If we can do all this, we'll be able to do a bulk upgrade too
     260    eval {
     261        my $sth = $dbh->prepare("CREATE TABLE dbtest (test int)");
     262        $sth->execute;
     263
     264        $sth = $dbh->prepare("CREATE INDEX dbtest_index ON dbtest (test)");
     265        $sth->execute;
     266
     267        $sth = $dbh->prepare("DROP TABLE dbtest");
     268        $sth->execute;
     269    };
     270    return $@;
     271}
  • wiki-toolkit/trunk/lib/Wiki/Toolkit/Setup/MySQL.pm

    r235 r319  
    130130                if($@) { warn $@; }
    131131
     132        # Check to make sure we can create, index and drop tables
     133        # before doing any more
     134        my $perm_check = Wiki::Toolkit::Setup::Database::perm_check($dbh);
     135        if ($perm_check) {
     136            die $perm_check;
     137        }
     138       
    132139                # Drop the current tables
    133140                cleardb($dbh);
Note: See TracChangeset for help on using the changeset viewer.