summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/DB')
-rw-r--r--Bugzilla/DB/Mysql.pm36
-rw-r--r--Bugzilla/DB/Pg.pm3
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) = @_;