Upgrade 2.11.11 to Contao 3.1.0, mysql error
Hi,
In Installtion Tools, upgrading Contao 2.11.11 to 3.1.0, In "version 3.1 update" step it return error:
Code:
Fatal error: Uncaught exception Exception with message Query error: Can't DROP 'path'; check that column/key exists (ALTER TABLE `tl_files` DROP INDEX `path`) thrown in system/modules/core/library/Contao/Database/Statement.php on line 346
#0 system/modules/core/library/Contao/Database.php(228): Contao\Database\Statement->query('ALTER TABLE `tl...')
#1 system/modules/core/library/Contao/Database/Updater.php(468): Contao\Database->query('ALTER TABLE `tl...')
#2 contao/install.php(956): Contao\Database\Updater->run31Update()
#3 contao/install.php(530): InstallTool->update31()
#4 contao/install.php(181): InstallTool->runDatabaseUpdates()
#5 contao/install.php(971): InstallTool->run()
#6 {main}
How I can fix this?
Re: Upgrade 2.11.11 to Contao 3.1.0, mysql error
Does the error repeat when you try opening the contao/install.php script and update a second time?
The obvious workaround is to add an index to that field so the install script can remove it. It may be you need to add the path field if it doesn't exist instead of adding/removing the key. It is probably either one or the other because an assumption is done and appears untrue.
These are the two relevant fields. You can't import this code, but need to use a tool like PhpMyAdmin to make a field path and add the key
Code:
CREATE TABLE `tl_files` (
`path` blob,
UNIQUE KEY `path` (`path`)
);
I must say; I've ran into several db errors when upgrading contao installations. I bothers me they exist, but everytime I reload the script Contao continues and I'm on my way again, forgetting the error even happened. Contao will always check the entire database and every field to make sure it is correct when you run the installer or the "update database" script. So even if you have such an error, normally you would be able to rcover without changing the db structure (I've never had to create/change a single field since using Contao)