Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
788beb08
Commit
788beb08
authored
Sep 04, 2006
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 341091: checksetup breaks if there are duplicate versions for a product
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=myk
parent
f78548a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
DB.pm
Bugzilla/Install/DB.pm
+27
-2
No files found.
Bugzilla/Install/DB.pm
View file @
788beb08
...
@@ -406,8 +406,7 @@ sub update_table_definitions {
...
@@ -406,8 +406,7 @@ sub update_table_definitions {
# 2005-04-28 - LpSolit@gmail.com - Bug 7233: add an index to versions
# 2005-04-28 - LpSolit@gmail.com - Bug 7233: add an index to versions
$dbh
->
bz_alter_column
(
'versions'
,
'value'
,
$dbh
->
bz_alter_column
(
'versions'
,
'value'
,
{
TYPE
=>
'varchar(64)'
,
NOTNULL
=>
1
});
{
TYPE
=>
'varchar(64)'
,
NOTNULL
=>
1
});
$dbh
->
bz_add_index
(
'versions'
,
'versions_product_id_idx'
,
_add_versions_product_id_index
();
{
TYPE
=>
'UNIQUE'
,
FIELDS
=>
[
qw(product_id value)
]});
if
(
!
exists
$dbh
->
bz_column_info
(
'milestones'
,
'sortkey'
)
->
{
DEFAULT
})
{
if
(
!
exists
$dbh
->
bz_column_info
(
'milestones'
,
'sortkey'
)
->
{
DEFAULT
})
{
$dbh
->
bz_alter_column
(
'milestones'
,
'sortkey'
,
$dbh
->
bz_alter_column
(
'milestones'
,
'sortkey'
,
...
@@ -2298,6 +2297,32 @@ sub _change_all_mysql_booleans_to_tinyint {
...
@@ -2298,6 +2297,32 @@ sub _change_all_mysql_booleans_to_tinyint {
}
}
}
}
# A helper for the below function.
sub
_de_dup_version
{
my
(
$product_id
,
$version
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
print
"Fixing duplicate version $version in product_id $product_id...\n"
;
$dbh
->
do
(
'DELETE FROM versions WHERE product_id = ? AND value = ?'
,
undef
,
$product_id
,
$version
);
$dbh
->
do
(
'INSERT INTO versions (product_id, value) VALUES (?,?)'
,
undef
,
$product_id
,
$version
);
}
sub
_add_versions_product_id_index
{
my
$dbh
=
Bugzilla
->
dbh
;
if
(
!
$dbh
->
bz_index_info
(
'versions'
,
'versions_product_id_idx'
))
{
my
$dup_versions
=
$dbh
->
selectall_arrayref
(
'SELECT product_id, value FROM versions
GROUP BY product_id, value HAVING COUNT(value) > 1'
,
{
Slice
=>
{}});
foreach
my
$dup_version
(
@$dup_versions
)
{
_de_dup_version
(
$dup_version
->
{
product_id
},
$dup_version
->
{
value
});
}
$dbh
->
bz_add_index
(
'versions'
,
'versions_product_id_idx'
,
{
TYPE
=>
'UNIQUE'
,
FIELDS
=>
[
qw(product_id value)
]});
}
}
sub
_fix_whine_queries_title_and_op_sys_value
{
sub
_fix_whine_queries_title_and_op_sys_value
{
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
if
(
!
exists
$dbh
->
bz_column_info
(
'whine_queries'
,
'title'
)
->
{
DEFAULT
})
{
if
(
!
exists
$dbh
->
bz_column_info
(
'whine_queries'
,
'title'
)
->
{
DEFAULT
})
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment