I've got an issue that following a server rebuild, I was prompted to update Craft, which I did by moving a brand new craft/app folder into place - then setting relevant permissions. I then tried to browse to the management once again, to be greeted by the 'finish up' button and the fact that Craft had to make a couple of changes to the database to finish the update. This is where I am encountering an error message of:
Craft was unable to install this update :( The site has been restored to the state it was in before the attempted update. There was a problem updating your database.
My database credentials are correct, and I have had this issue on 2 servers now with different builds (different ubuntu version, php, apache & sql). Could anybody tell me if they have seen this before and how to diagnose this issue?
Ubuntu 16.04.1 PHP7.0 Mysql 5.7 Apache 2.4.18
Craft log of the incident:
2016/12/21 10:35:49 [info] [application] [Forced] Preparing to update craft.
2016/12/21 10:35:49 [info] [application] [Forced] Finished preparing to update craft.
******************************************************************************************************
2016/12/21 10:35:49 [info] [application] [Forced] Starting to backup database.
2016/12/21 10:35:49 [info] [application] [Forced] Starting to backup database.
2016/12/21 10:35:49 [info] [application] [Forced] Finished backing up database.
******************************************************************************************************
2016/12/21 10:35:49 [info] [application] [Forced] Starting to update the database.
2016/12/21 10:35:49 [info] [application] [Forced] Craft wants to update the database.
2016/12/21 10:35:49 [info] [application] [Forced] Running migrations...
2016/12/21 10:35:49 [info] [application] [Forced] Total 23 new migrations to be applied for Craft:
2016/12/21 10:35:49 [info] [application] [Forced] m141030_000000_plugin_schema_versions
2016/12/21 10:35:49 [info] [application] [Forced] m150724_000001_adjust_quality_settings
2016/12/21 10:35:49 [info] [application] [Forced] m150827_000000_element_index_settings
2016/12/21 10:35:49 [info] [application] [Forced] m150918_000001_add_colspan_to_widgets
2016/12/21 10:35:49 [info] [application] [Forced] m151007_000000_clear_asset_caches
2016/12/21 10:35:49 [info] [application] [Forced] m151109_000000_text_url_formats
2016/12/21 10:35:49 [info] [application] [Forced] m151110_000000_move_logo
2016/12/21 10:35:49 [info] [application] [Forced] m151117_000000_adjust_image_widthheight
2016/12/21 10:35:49 [info] [application] [Forced] m151127_000000_clear_license_key_status
2016/12/21 10:35:49 [info] [application] [Forced] m151127_000000_plugin_license_keys
2016/12/21 10:35:49 [info] [application] [Forced] m151130_000000_update_pt_widget_feeds
2016/12/21 10:35:49 [info] [application] [Forced] m160114_000000_asset_sources_public_url_default_true
2016/12/21 10:35:49 [info] [application] [Forced] m160223_000000_sortorder_to_smallint
2016/12/21 10:35:49 [info] [application] [Forced] m160229_000000_set_default_entry_statuses
2016/12/21 10:35:49 [info] [application] [Forced] m160304_000000_client_permissions
2016/12/21 10:35:49 [info] [application] [Forced] m160322_000000_asset_filesize
2016/12/21 10:35:49 [info] [application] [Forced] m160503_000000_orphaned_fieldlayouts
2016/12/21 10:35:49 [info] [application] [Forced] m160510_000000_tasksettings
2016/12/21 10:35:49 [info] [application] [Forced] m160829_000000_pending_user_content_cleanup
2016/12/21 10:35:49 [info] [application] [Forced] m160830_000000_asset_index_uri_increase
2016/12/21 10:35:49 [info] [application] [Forced] m160919_000000_usergroup_handle_title_unique
2016/12/21 10:35:49 [info] [application] [Forced] m161108_000000_new_version_format
2016/12/21 10:35:49 [info] [application] [Forced] m161109_000000_index_shuffle
2016/12/21 10:35:49 [info] [application] [Forced] Applying migration: m141030_000000_plugin_schema_versions
2016/12/21 10:35:50 [info] [application] [Forced] Applied migration: m141030_000000_plugin_schema_versions (time: 0.121s)
2016/12/21 10:35:50 [info] [application] [Forced] Applying migration: m150724_000001_adjust_quality_settings
2016/12/21 10:35:50 [info] [application] [Forced] Adjusting Asset transform quality settings
2016/12/21 10:35:50 [info] [application] [Forced] Done adjusting Asset transform quality settings
2016/12/21 10:35:50 [info] [application] [Forced] Applied migration: m150724_000001_adjust_quality_settings (time: 0.005s)
2016/12/21 10:35:50 [info] [application] [Forced] Applying migration: m150827_000000_element_index_settings
2016/12/21 10:35:50 [info] [application] [Forced] Creating the elementindexsettings table
2016/12/21 10:35:50 [error] [system.db.CDbCommand] CDbCommand::execute() failed: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_elementindexsett$
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` VARCHAR(150) NOT NULL,
`settings` text NULL,
`dateCreated` datetime NOT NULL,
`dateUpdated` datetime NOT NULL,
`uid` CHAR(36) NOT NULL DEFAULT 0,
PRIMARY KEY (id)
) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci.
2016/12/21 10:35:50 [error] [application] CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'Ui28t_element$
2016/12/21 10:35:50 [error] [application] #0 /var/www/craft/app/framework/db/CDbCommand.php(1352): CDbCommand->execute()
#1 /var/www/craft/app/etc/db/DbCommand.php(507): CDbCommand->createTable('Ui28t_elementin...', Array, NULL)
#2 /var/www/craft/app/migrations/m150827_000000_element_index_settings.php(21): Craft\DbCommand->createTable('Ui28t_elementin...', Array, NULL, true)
#3 /var/www/craft/app/etc/db/BaseMigration.php(33): Craft\m150827_000000_element_index_settings->safeUp()
#4 /var/www/craft/app/services/MigrationsService.php(149): Craft\BaseMigration->up()
#5 /var/www/craft/app/services/MigrationsService.php(91): Craft\MigrationsService->migrateUp('m150827_000000_...', NULL)
#6 /var/www/craft/app/etc/updates/Updater.php(180): Craft\MigrationsService->runToTop(NULL)
#7 /var/www/craft/app/services/UpdatesService.php(724): Craft\Updater->updateDatabase()
#8 /var/www/craft/app/controllers/UpdateController.php(405): Craft\UpdatesService->updateDatabase('craft')
#9 /var/www/craft/app/framework/web/actions/CInlineAction.php(49): Craft\UpdateController->actionUpdateDatabase()
#10 /var/www/craft/app/framework/web/CController.php(308): CInlineAction->runWithParams(Array)
#11 /var/www/craft/app/framework/web/CController.php(286): CController->runAction(Object(CInlineAction))
#12 /var/www/craft/app/framework/web/CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#13 /var/www/craft/app/framework/web/CWebApplication.php(282): CController->run('updateDatabase')
#14 /var/www/craft/app/etc/web/WebApp.php(931): CWebApplication->runController('update/updateDa...')
#15 /var/www/craft/app/etc/web/WebApp.php(241): Craft\WebApp->_processUpdateLogic()
#16 /var/www/craft/app/framework/base/CApplication.php(185): Craft\WebApp->processRequest()
#17 /var/www/craft/app/index.php(62): CApplication->run()
#18 /var/www/public_html/index.php(19): require_once('/var/www/craft/...')
#19 {main}
2016/12/21 10:35:50 [error] [application] Failed to apply migration: m150827_000000_element_index_settings (time: 0.001s)
2016/12/21 10:35:50 [error] [application] Migration failed for Craft. All later Craft migrations are canceled.
******************************************************************************************************
2016/12/21 10:35:50 [info] [application] [Forced] Rolling back any database changes.
Many thanks in advance guys! Let me know if you need any more info.