summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB/Sqlite.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2011-08-30 00:22:47 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2011-08-30 00:22:47 +0200
commitea946eb23e405553861997b9158847dee59dd722 (patch)
tree314fb014925c65f769e237ed58b6860f978df3aa /Bugzilla/DB/Sqlite.pm
parent8e5e72fccecb5ad778188d0d3a807cc5c0c0ac7c (diff)
downloadbugzilla-ea946eb23e405553861997b9158847dee59dd722.tar.gz
bugzilla-ea946eb23e405553861997b9158847dee59dd722.tar.xz
Bug 629529: Make SQLite installs able to use jobqueue.pl
r=glob, a=mkanat
Diffstat (limited to 'Bugzilla/DB/Sqlite.pm')
-rw-r--r--Bugzilla/DB/Sqlite.pm41
1 files changed, 41 insertions, 0 deletions
diff --git a/Bugzilla/DB/Sqlite.pm b/Bugzilla/DB/Sqlite.pm
index fab1e3c87..fb6aaba97 100644
--- a/Bugzilla/DB/Sqlite.pm
+++ b/Bugzilla/DB/Sqlite.pm
@@ -25,6 +25,7 @@ use base qw(Bugzilla::DB);
use Bugzilla::Constants;
use Bugzilla::Error;
+use Bugzilla::Install::Util qw(install_string);
use DateTime;
use POSIX ();
@@ -246,6 +247,46 @@ sub sql_string_until {
# bz_ methods #
###############
+sub bz_setup_database {
+ my $self = shift;
+ $self->SUPER::bz_setup_database(@_);
+
+ # If we created TheSchwartz tables with COLLATE bugzilla (during the
+ # 4.1.x development series) re-create them without it.
+ my @tables = $self->bz_table_list();
+ my @ts_tables = grep { /^ts_/ } @tables;
+ my $drop_ok;
+ foreach my $table (@ts_tables) {
+ my $create_table =
+ $self->_bz_real_schema->_sqlite_create_table($table);
+ if ($create_table =~ /COLLATE bugzilla/) {
+ if (!$drop_ok) {
+ _sqlite_jobqueue_drop_message();
+ $drop_ok = 1;
+ }
+ $self->bz_drop_table($table);
+ $self->bz_add_table($table);
+ }
+ }
+}
+
+sub _sqlite_jobqueue_drop_message {
+ # This is not translated because this situation will only happen if
+ # you are updating from a 4.1.x development version of Bugzilla using
+ # SQLite, and we don't want to maintain this string in strings.txt.pl
+ # forever for just this one uncommon circumstance.
+ print <<END;
+WARNING: We have to re-create all the database tables used by jobqueue.pl.
+If there are any pending jobs in the database (that is, emails that
+haven't been sent), they will be deleted.
+
+END
+ unless (Bugzilla->installation_answers->{NO_PAUSE}) {
+ print install_string('enter_or_ctrl_c');
+ getc;
+ }
+}
+
# XXX This needs to be implemented.
sub bz_explain { }