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
ea10fefd
Commit
ea10fefd
authored
Jun 17, 2014
by
David Lawrence
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1021218: merge-users.pl fails if both users have bug_user_last_visit entries for the same bug
r=glob,a=glob
parent
1f859a39
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
merge-users.pl
contrib/merge-users.pl
+13
-0
No files found.
contrib/merge-users.pl
View file @
ea10fefd
...
...
@@ -145,6 +145,19 @@ $dbh->bz_start_transaction();
$dbh
->
do
(
'DELETE FROM logincookies WHERE userid = ?'
,
undef
,
$old_id
);
$dbh
->
do
(
'DELETE FROM tokens WHERE userid = ?'
,
undef
,
$old_id
);
# Special care needs to be done with bug_user_last_visit table as the
# source user and destination user may have visited the same bug id at one time.
# In this case we remove the one with the oldest timestamp.
my
$dupe_ids
=
$dbh
->
selectcol_arrayref
(
"
SELECT earlier.id
FROM bug_user_last_visit as earlier
INNER JOIN bug_user_last_visit as later
ON (earlier.user_id != later.user_id AND earlier.last_visit_ts < later.last_visit_ts
AND earlier.bug_id = later.bug_id)
WHERE (earlier.user_id = ? OR earlier.user_id = ?)"
,
undef
,
$old_id
,
$new_id
);
$dbh
->
do
(
"DELETE FROM bug_user_last_visit WHERE "
.
$dbh
->
sql_in
(
'id'
,
$dupe_ids
));
# Migrate records from old user to new user.
foreach
my
$table
(
keys
%
changes
)
{
foreach
my
$column_list
(
@
{
$changes
{
$table
}
})
{
...
...
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