Migration 20170719231144 failed during Execution. Error An exception occurred while executing '
UPDATE wallabag_entry_tag
SET tag_id = 2074
WHERE tag_id IN (2075)
AND entry_id NOT IN (
SELECT entry_id
FROM wallabag_entry_tag
WHERE tag_id = 2074
)':
SQLSTATE[HY000]: General error: 1093 Table 'wallabag_entry_tag' is specified twice, both as a target for 'UPDATE' and as a separate source for data
git clone or by downloading the package?make update
Should be to replace in app/DoctrineMigrations/Version20170719231144.php
$this->addSql('
UPDATE ' . $this->getTable('entry_tag') . '
SET tag_id = ' . $newId . '
WHERE tag_id IN (' . implode(',', $ids) . ')
AND entry_id NOT IN (
SELECT entry_id
FROM ' . $this->getTable('entry_tag') . '
WHERE tag_id = ' . $newId . '
)'
);
By something like :
$this->addSql('
UPDATE ' . $this->getTable('entry_tag') . '
SET tag_id = ' . $newId . '
WHERE tag_id IN (' . implode(',', $ids) . ')
AND entry_id NOT IN (
SELECT entry_id
FROM (select * from ' . $this->getTable('entry_tag') . ') AS mytablename
WHERE tag_id = ' . $newId . '
)'
);
Because I think it's a MariaDB SQL syntax error
Can I modify myself this file, run it alone and update the "migration_versions" table ?
I did modify the file as indicated by @FrenchHope and ran
php bin/console doctrine:migrations:migrate --no-interaction --env=prod
php bin/console cache:clear --env=prod
as indicated in https://github.com/wallabag/wallabag/blob/master/scripts/update.sh#L19
It ran smoothly. Anyway, a patch is needed to make it easy for everyone.
Could you try this, instead:
$this->addSql('
UPDATE ' . $this->getTable('entry_tag') . '
SET tag_id = ' . $newId . '
WHERE tag_id IN (' . implode(',', $ids) . ')
AND entry_id NOT IN (
SELECT entry_id
FROM ' . $this->getTable('entry_tag') . ' AS _entry_tag
WHERE tag_id = ' . $newId . '
)'
);
Thank you @Chouchen , it worked.
@Kdecherf it didn't worked on my configuration, but :
FROM (select * from ' . $this->getTable('entry_tag') . ') AS _entry_tag
instead of
FROM ' . $this->getTable('entry_tag') . ' AS _entry_tag
worked
Same for me, the solution @Kdecherf worked with the fix of @FrenchHope.
Most helpful comment
I did modify the file as indicated by @FrenchHope and ran
as indicated in https://github.com/wallabag/wallabag/blob/master/scripts/update.sh#L19
It ran smoothly. Anyway, a patch is needed to make it easy for everyone.