mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-26 11:08:08 +01:00
Fixed duplicate plan_user_info removal on MySQL
This commit is contained in:
parent
7dead97213
commit
f1b42e9a58
@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Player Analytics (Plan).
|
||||||
|
*
|
||||||
|
* Plan is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Plan is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package com.djrapitops.plan.db.access.transactions.init;
|
package com.djrapitops.plan.db.access.transactions.init;
|
||||||
|
|
||||||
import com.djrapitops.plan.db.access.transactions.Transaction;
|
import com.djrapitops.plan.db.access.transactions.Transaction;
|
||||||
@ -25,7 +41,10 @@ public class RemoveDuplicateUserInfoTransaction extends Transaction {
|
|||||||
execute(
|
execute(
|
||||||
"DELETE" + FROM + UserInfoTable.TABLE_NAME +
|
"DELETE" + FROM + UserInfoTable.TABLE_NAME +
|
||||||
WHERE + COLUMN_ID +
|
WHERE + COLUMN_ID +
|
||||||
" NOT IN (" + STATEMENT_SELECT_DUPLICATE_IDS + ')'
|
// Nested query here is required because MySQL limits update statements with nested queries:
|
||||||
|
// The nested query creates a temporary table that bypasses the same table query-update limit.
|
||||||
|
// Note: MySQL versions 5.6.7+ might optimize this nested query away leading to an exception.
|
||||||
|
" NOT IN (" + SELECT + "id" + FROM + '(' + STATEMENT_SELECT_DUPLICATE_IDS + ") as ids)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user