diff options
author | mkanat%kerio.com <> | 2005-03-09 14:45:34 +0100 |
---|---|---|
committer | mkanat%kerio.com <> | 2005-03-09 14:45:34 +0100 |
commit | f53d4eacd120cdcc4d64bcc06ac3a72f8277a1f4 (patch) | |
tree | 4f59d040c801bb87166b5ad1bea40f1cfe98ae3f /Bugzilla/DB | |
parent | 64dcdcd3d321a66e880a28510fb20a1a3d05c445 (diff) | |
download | bugzilla-f53d4eacd120cdcc4d64bcc06ac3a72f8277a1f4.tar.gz bugzilla-f53d4eacd120cdcc4d64bcc06ac3a72f8277a1f4.tar.xz |
Bug 284348: Move initial table creation into the Bugzilla::DB modules
Patch By Max Kanat-Alexander <mkanat@kerio.com> r=glob, r=Tomas.Kopal, a=justdave
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 36 | ||||
-rw-r--r-- | Bugzilla/DB/Pg.pm | 3 |
2 files changed, 38 insertions, 1 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 76cd0966d..14230b188 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -49,6 +49,7 @@ use base qw(Bugzilla::DB); use constant REQUIRED_VERSION => '3.23.41'; use constant PROGRAM_NAME => 'MySQL'; +use constant MODULE_NAME => 'Mysql'; sub new { my ($class, $user, $pass, $host, $dbname, $port, $sock) = @_; @@ -189,4 +190,39 @@ sub bz_rollback_transaction { die("Attempt to rollback transaction on DB without transaction support"); } +##################################################################### +# Database Setup +##################################################################### + +sub bz_setup_database { + my ($self) = @_; + + # Figure out if any existing tables are of type ISAM and convert them + # to type MyISAM if so. ISAM tables are deprecated in MySQL 3.23, + # which Bugzilla now requires, and they don't support more than 16 + # indexes per table, which Bugzilla needs. + my $sth = $self->prepare("SHOW TABLE STATUS"); + $sth->execute; + my @isam_tables = (); + while (my ($name, $type) = $sth->fetchrow_array) { + push(@isam_tables, $name) if $type eq "ISAM"; + } + + if(scalar(@isam_tables)) { + print "One or more of the tables in your existing MySQL database are\n" + . "of type ISAM. ISAM tables are deprecated in MySQL 3.23 and\n" + . "don't support more than 16 indexes per table, which \n" + . "Bugzilla needs.\n Converting your ISAM tables to type" + . " MyISAM:\n\n"; + foreach my $table (@isam_tables) { + print "Converting table $table... "; + $self->do("ALTER TABLE $table TYPE = MYISAM"); + print "done.\n"; + } + print "\nISAM->MyISAM table conversion done.\n\n"; + } + + $self->SUPER::bz_setup_database(); +} + 1; diff --git a/Bugzilla/DB/Pg.pm b/Bugzilla/DB/Pg.pm index 5963f5308..2ec3000d5 100644 --- a/Bugzilla/DB/Pg.pm +++ b/Bugzilla/DB/Pg.pm @@ -47,8 +47,9 @@ use Carp; # This module extends the DB interface via inheritance use base qw(Bugzilla::DB); -use constant REQUIRED_VERSION => '7.02.0000'; +use constant REQUIRED_VERSION => '7.03.0000'; use constant PROGRAM_NAME => 'PostgreSQL'; +use constant MODULE_NAME => 'Pg'; sub new { my ($class, $user, $pass, $host, $dbname, $port) = @_; |