summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/DB/Schema.pm6
-rw-r--r--Bugzilla/Install/DB.pm26
2 files changed, 26 insertions, 6 deletions
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 09475807c..5a88540a9 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -342,7 +342,7 @@ use constant ABSTRACT_SCHEMA => {
bugs_activity => {
FIELDS => [
- id => {TYPE => 'MEDIUMSERIAL', NOTNULL => 1,
+ id => {TYPE => 'INTSERIAL', NOTNULL => 1,
PRIMARYKEY => 1},
bug_id => {TYPE => 'INT3', NOTNULL => 1,
REFERENCES => {TABLE => 'bugs',
@@ -361,7 +361,7 @@ use constant ABSTRACT_SCHEMA => {
COLUMN => 'id'}},
added => {TYPE => 'varchar(255)'},
removed => {TYPE => 'varchar(255)'},
- comment_id => {TYPE => 'INT3',
+ comment_id => {TYPE => 'INT4',
REFERENCES => { TABLE => 'longdescs',
COLUMN => 'comment_id',
DELETE => 'CASCADE'}},
@@ -396,7 +396,7 @@ use constant ABSTRACT_SCHEMA => {
longdescs => {
FIELDS => [
- comment_id => {TYPE => 'MEDIUMSERIAL', NOTNULL => 1,
+ comment_id => {TYPE => 'INTSERIAL', NOTNULL => 1,
PRIMARYKEY => 1},
bug_id => {TYPE => 'INT3', NOTNULL => 1,
REFERENCES => {TABLE => 'bugs',
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index b2cf1194f..6a8dbc64a 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -454,8 +454,8 @@ sub update_table_definitions {
_clean_control_characters_from_short_desc();
# 2005-12-07 altlst@sonic.net -- Bug 225221
- $dbh->bz_add_column('longdescs', 'comment_id',
- {TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
+ # 2012-07-24 dkl@mozilla.com - Bug 776982
+ _fix_longdescs_primary_key();
_stop_storing_inactive_flags();
_change_short_desc_from_mediumtext_to_varchar();
@@ -676,12 +676,17 @@ sub update_table_definitions {
# 2012-06-13 dkl@mozilla.com - Bug 764457
$dbh->bz_add_column('bugs_activity', 'id',
- {TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
+ {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
# 2012-06-13 dkl@mozilla.com - Bug 764466
$dbh->bz_add_column('profiles_activity', 'id',
{TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
+ # 2012-07-24 dkl@mozilla.com - Bug 776972
+ $dbh->bz_alter_column('bugs_activity', 'id',
+ {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
+
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -3708,6 +3713,21 @@ sub _fix_notnull_defaults {
}
}
+sub _fix_longdescs_primary_key {
+ my $dbh = Bugzilla->dbh;
+ my $column_def = {TYPE => 'INTSERIAL', NOTNULL => 1, PRIMARYKEY => 1};
+ if (!$dbh->bz_column_info('longdescs', 'comment_id')) {
+ $dbh->bz_add_column('longdescs', 'comment_id', $column_def);
+ }
+ elsif ($dbh->bz_column_info('longdescs', 'comment_id')->{TYPE} ne 'INTSERIAL') {
+ $dbh->bz_drop_fk('bugs_activity', 'comment_id');
+ $dbh->bz_alter_column('bugs_activity', 'comment_id', {TYPE => 'INT4'});
+ $dbh->bz_alter_column('longdescs', 'comment_id', $column_def);
+ $dbh->bz_add_fk('bugs_activity', 'comment_id',
+ {TABLE => 'longdescs', COLUMN => 'comment_id', DELETE => 'CASCADE'});
+ }
+}
+
1;
__END__