Duplicate primary key values while updating
- Keywords:
While you're updating an old installation of PHPDevShell (using the built-in updater), you may encouter a strange error: they are duplicates keys in the primary key index.
This is because at some point a table was slightly redesigned: a primary key has been added to optimize access. Unfortunatly your table already contain duplicates. It's not a problem for PHPDevShell MySQL chokes on them.
In this case, you have to "purge" the table from the useless entries. You can do it manually but it can be tedious. Fortunatly there's a quick and clean way to do that.
Let's the upgrader tells us the offending table is "pds_core_
# create the temp table
CREATE TABLE `pds_core_
# fill it with the purged data
insert into `pds_core_
# swap the tables
rename table `pds_core_
rename table `pds_core_
After the upgrade has been done, we can delete the dirty table:
drop table `pds_core_