fix: [migration:unique_usernames] Table 'users' is specified twice, both as a target and as a separate source
parent
760badd268
commit
f37cea1cad
|
@ -20,7 +20,7 @@ final class UniqueUserNames extends AbstractMigration
|
||||||
{
|
{
|
||||||
$table = $this->table('users');
|
$table = $this->table('users');
|
||||||
$exists = $table->hasIndexByName('users', 'username');
|
$exists = $table->hasIndexByName('users', 'username');
|
||||||
$this->execute('DELETE FROM users WHERE id NOT IN (SELECT MIN(id) FROM users GROUP BY LOWER(username));');
|
$this->execute('DELETE FROM users WHERE id NOT IN (SELECT MIN(id) FROM (select * from users) AS u2 GROUP BY LOWER(u2.username));');
|
||||||
if (!$exists) {
|
if (!$exists) {
|
||||||
$table->addIndex(
|
$table->addIndex(
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in New Issue