Update migrateUserGroup so that if a user is in both the old group and
the new group, the script still succeeds. Otherwise, it will fail
with violations to the PRIMARY KEY index on the user_groups table.
Change-Id: I7bfda03f5735633d03b81092dad29d73293cd182
$dbw->update( 'user_groups',
array( 'ug_group' => $newGroup ),
array( 'ug_group' => $oldGroup,
$dbw->update( 'user_groups',
array( 'ug_group' => $newGroup ),
array( 'ug_group' => $oldGroup,
- "ug_user BETWEEN $blockStart AND $blockEnd" )
+ "ug_user BETWEEN $blockStart AND $blockEnd" ),
+ __METHOD__,
+ array( 'IGNORE' )
+ );
+ $count += $dbw->affectedRows();
+ $dbw->delete( 'user_groups',
+ array( 'ug_group' => $oldGroup,
+ "ug_user BETWEEN $blockStart AND $blockEnd" ),
+ __METHOD__
);
$count += $dbw->affectedRows();
$dbw->commit( __METHOD__ );
);
$count += $dbw->affectedRows();
$dbw->commit( __METHOD__ );