summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/DB/Schema.pm2
-rw-r--r--Bugzilla/Install/DB.pm13
-rw-r--r--Bugzilla/Series.pm9
-rwxr-xr-xsanitycheck.cgi2
4 files changed, 15 insertions, 11 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 1888c76c0..a26eb311b 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -915,7 +915,7 @@ use constant ABSTRACT_SCHEMA => {
FIELDS => [
series_id => {TYPE => 'MEDIUMSERIAL', NOTNULL => 1,
PRIMARYKEY => 1},
- creator => {TYPE => 'INT3', NOTNULL => 1},
+ creator => {TYPE => 'INT3'},
category => {TYPE => 'INT2', NOTNULL => 1},
subcategory => {TYPE => 'INT2', NOTNULL => 1},
name => {TYPE => 'varchar(64)', NOTNULL => 1},
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index d34a11f24..a7f20625a 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -277,6 +277,14 @@ sub update_table_definitions {
_remove_spaces_and_commas_from_flagtypes();
_setup_usebuggroups_backward_compatibility();
_remove_user_series_map();
+
+ # 2006-08-03 remi_zara@mac.com bug 346241, make series.creator nullable
+ # This must happen before calling _copy_old_charts_into_database().
+ if ($dbh->bz_column_info('series', 'creator')->{NOTNULL}) {
+ $dbh->bz_alter_column('series', 'creator', {TYPE => 'INT3'});
+ $dbh->do("UPDATE series SET creator = NULL WHERE creator = 0");
+ }
+
_copy_old_charts_into_database();
_add_user_group_map_grant_type();
@@ -1877,9 +1885,8 @@ sub _copy_old_charts_into_database {
foreach my $field (@fields) {
# Create a Series for each field in this product.
- # user ID = 0 is used.
my $series = new Bugzilla::Series(undef, $product, $all_name,
- $field, 0, 1,
+ $field, undef, 1,
$queries{$field}, 1);
$series->writeToDatabase();
$seriesids{$field} = $series->{'series_id'};
@@ -1890,7 +1897,7 @@ sub _copy_old_charts_into_database {
my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED");
my $query = join("&", map { "bug_status=$_" } @openedstatuses);
my $series = new Bugzilla::Series(undef, $product, $all_name,
- $open_name, 0, 1,
+ $open_name, undef, 1,
$query_prod . $query, 1);
$series->writeToDatabase();
$seriesids{$open_name} = $series->{'series_id'};
diff --git a/Bugzilla/Series.pm b/Bugzilla/Series.pm
index 4693a7131..011e60168 100644
--- a/Bugzilla/Series.pm
+++ b/Bugzilla/Series.pm
@@ -36,8 +36,6 @@ use Bugzilla::Error;
use Bugzilla::Util;
use Bugzilla::User;
-use constant PUBLIC_USER_ID => 0;
-
sub new {
my $invocant = shift;
my $class = ref($invocant) || $invocant;
@@ -201,10 +199,9 @@ sub writeToDatabase {
# Insert the new series into the series table
$dbh->do("INSERT INTO series (creator, category, subcategory, " .
"name, frequency, query, is_public) VALUES " .
- "($self->{'creator'}, " .
- "$category_id, $subcategory_id, " .
- $dbh->quote($self->{'name'}) . ", $self->{'frequency'}," .
- $dbh->quote($self->{'query'}) . ", $self->{'public'})");
+ "(?, ?, ?, ?, ?, ?, ?)", undef,
+ $self->{'creator'}, $category_id, $subcategory_id, $self->{'name'},
+ $self->{'frequency'}, $self->{'query'}, $self->{'public'});
# Retrieve series_id
$self->{'series_id'} = $dbh->selectrow_array("SELECT MAX(series_id) " .
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 0a756c3fb..174edc9c3 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -445,7 +445,7 @@ CrossCheck("profiles", "userid",
["logincookies", "userid"],
["namedqueries", "userid"],
["namedqueries_link_in_footer", "user_id"],
- ['series', 'creator', 'series_id', ['0']],
+ ['series', 'creator', 'series_id'],
["watch", "watcher"],
["watch", "watched"],
['whine_events', 'owner_userid'],