summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install
diff options
context:
space:
mode:
authorStephanie Daugherty <sdaugherty@gmail.com>2011-08-29 23:29:30 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2011-08-29 23:29:30 +0200
commit8e5e72fccecb5ad778188d0d3a807cc5c0c0ac7c (patch)
tree0a846f335e338fcb7a38db932e3217095d9f03c9 /Bugzilla/Install
parentdd0e1c27011f13edc0083078ebef7d061822cff7 (diff)
downloadbugzilla-8e5e72fccecb5ad778188d0d3a807cc5c0c0ac7c.tar.gz
bugzilla-8e5e72fccecb5ad778188d0d3a807cc5c0c0ac7c.tar.xz
Bug 637648 - Rename the "tags" table to "tag"
r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r--Bugzilla/Install/DB.pm20
1 files changed, 18 insertions, 2 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index af276882c..5ce3c7a4e 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -646,6 +646,8 @@ sub update_table_definitions {
$dbh->bz_add_column('bug_see_also', 'id',
{TYPE => 'MEDIUMSERIAL', NOTNULL => 1, PRIMARYKEY => 1});
+ _rename_tags_to_tag();
+
# 2011-01-29 LpSolit@gmail.com - Bug 616185
_migrate_user_tags();
@@ -3485,9 +3487,9 @@ sub _migrate_user_tags {
WHERE query_type != 0');
my $sth_tags = $dbh->prepare(
- 'INSERT INTO tags (user_id, name) VALUES (?, ?)');
+ 'INSERT INTO tag (user_id, name) VALUES (?, ?)');
my $sth_tag_id = $dbh->prepare(
- 'SELECT id FROM tags WHERE user_id = ? AND name = ?');
+ 'SELECT id FROM tag WHERE user_id = ? AND name = ?');
my $sth_bug_tag = $dbh->prepare('INSERT INTO bug_tag (bug_id, tag_id)
VALUES (?, ?)');
my $sth_nq = $dbh->prepare('UPDATE namedqueries SET query = ?
@@ -3586,6 +3588,20 @@ sub _migrate_disabledtext_boolean {
}
}
+sub _rename_tags_to_tag {
+ my $dbh = Bugzilla->dbh;
+ if ($dbh->bz_table_info('tags')) {
+ # If we get here, it's because the schema created "tag" as an empty
+ # table while "tags" still exists. We get rid of the empty
+ # tag table so we can do the rename over the top of it.
+ $dbh->bz_drop_table('tag');
+ $dbh->bz_drop_index('tags', 'tags_user_id_idx');
+ $dbh->bz_rename_table('tags','tag');
+ $dbh->bz_add_index('tag', 'tag_user_id_idx',
+ {FIELDS => [qw(user_id name)], TYPE => 'UNIQUE'});
+ }
+}
+
1;
__END__