Cms: SQL error while update to 3 from 2.6.2960

Created on 4 Feb 2017  Â·  20Comments  Â·  Source: craftcms/cms

Description

Database error

Craft CMS was unable to install this update :(

The site has been restored to the state it was in before the attempted update.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'version' in 'field list' The SQL being executed was: SELECT version AS name, applyTime FROM crf_migrations WHERE pluginId IS NULL ORDER BY name DESC

Steps to reproduce

1-6 Steps from Updating Craft CMS docs

Additional info

  • Craft version: 2.6.2960
  • PHP version: 7.0
  • Database driver & version: MySQL version: 5.6.33-0ubuntu0.14.04.1-log through PHP extension MySQLi
  • Plugins & versions: all plugins has been disabled
bug normal

All 20 comments

Same problem here

Upgrade errors are usually due to something project-specific. If you send a 2.6 DB backup to [email protected] we can look into it from there.

Just try to upgrade even fresh install Craft version: 2.6.2960

I just tried the same. Upgrading from a fresh Craft install (version: 2.6.2960). Unfortunately I received the same error message: _'Craft CMS was unable to install this update :('_

After refreshing the page and a retry, I received the message:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'version' in 'field list' The SQL being executed was: SELECTversionASname,applyTimeFROMcraft_migrationsWHEREpluginIdIS NULL ORDER BYnameDESC

@Bronskiy Just re-tested with a fresh 2.6 DB and it’s still working on my end.

@SamLNL that error is probably happening as a result of the botched update, not the error that caused the botched update in the first place.

After getting the update error, please zip up and send your storage/logs/ folder and send to [email protected].

@Bronskiy @SamLNL I'm 80% confident this fixes this issue: https://github.com/craftcms/cms/commit/2957f390a8c55a309fc671af6c16371b2ea9798a

After the next C3 beta release (due out Real Soon Nowâ„¢) can you try again and see if the issue is resolved?

Just tried to update live website and clean install to beta 3. Still doesn't work. Sent Error to the [email protected]

Same.

I also sent my error to Pixel & Tonic.

FYI I'm using serverpilot.io environment

@takobell how can I update beta 2 to beta 3. I have separate install with beta 2 and it says that I have the latest version.

Responded to both of your support tickets.

how can I update beta 2 to beta 3

@Bronskiy just run composer update

@takobell just replied to the email. I've sent SSH access to my server so you could try it by yourself

Just had the same problem trying to update from 2.6.2986 to 3.0.0-RC - have emailed my logs.

Having this issue...

@DZuz14 can you email your Craft 2 database backup to [email protected]?

Same problem here

I ran the upgrade from the command line with craft migrate --type=app and got this at the end of the migration:

86 migrations were applied.

Migrated up successfully.
Exception 'yii\db\Exception' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'version' in 'field list'
The SQL being executed was: SELECT `version` AS `name`, `applyTime`
FROM `craft_migrations`
WHERE `pluginId` IS NULL
ORDER BY `name` DESC'

in /app/vendor/yiisoft/yii2/db/Schema.php:664

Error Info:
Array
(
    [0] => 42S22
    [1] => 1054
    [2] => Unknown column 'version' in 'field list'
)

Stack trace:
#0 /app/vendor/yiisoft/yii2/db/Command.php(1263): yii\db\Schema->convertException(Object(PDOException), 'SELECT `version...')
#1 /app/vendor/yiisoft/yii2/db/Command.php(1148): yii\db\Command->internalExecute('SELECT `version...')
#2 /app/vendor/yiisoft/yii2/db/Command.php(399): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /app/vendor/craftcms/cms/src/db/Query.php(131): yii\db\Command->queryAll()
#4 /app/vendor/craftcms/cms/src/db/MigrationManager.php(333): craft\db\Query->pairs(Object(craft\db\Connection))
#5 /app/vendor/craftcms/cms/src/db/MigrationManager.php(403): craft\db\MigrationManager->getMigrationHistory()
#6 /app/vendor/craftcms/cms/src/console/controllers/MigrateController.php(353): craft\db\MigrationManager->getNewMigrations()
#7 /app/vendor/craftcms/cms/src/console/controllers/MigrateController.php(288): craft\console\controllers\MigrateController->getNewMigrations()
#8 [internal function]: craft\console\controllers\MigrateController->actionUp(0)
#9 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#10 /app/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#11 /app/vendor/yiisoft/yii2/console/Controller.php(148): yii\base\Controller->runAction('', Array)
#12 /app/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('', Array)
#13 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate', Array)
#14 /app/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('migrate', Array)
#15 /app/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#16 /app/craft(22): yii\base\Application->run()
#17 {main}

I was able to solve this while running MAMP Pro. This has happened to me a few times, where errors occured in the following steps:

  • Import Craft 2 Database into the new Craft 3 project
  • Visit 'http://myprojectname.test/admin' (I was greeted with the Finish up database changes prompt')
  • Upon clicking to finish the changes to the database, it timed out around 30 seconds, and Craft then showed a 500 Internal Server error.
  • Refreshing the page, and attempting to finish up the database again then prompted a new issue, which is the 1054 SQL error most people here have been getting here, specifically in regards to pluginId of null.

I am using MAMP Pro, where I am running multiple versions of PHP(FastCGI). The fix for this was to update max_execution_time in PHP.ini AND replace the mod_fastcgi block inside my Apache httpd.conf file

<IfModule mod_fastcgi.c>
    Alias /fcgi-bin/ "/Applications/MAMP/fcgi-bin/"

    # Anything in here is handled as a "dynamic" server if not defined as "static" or "external"
    <Directory "/Applications/MAMP/fcgi-bin/">
        SetHandler fastcgi-script
        Options +ExecCGI
    </Directory>

    AddHandler fastcgi-script .fcgi .fpl

    FastCgiIpcDir /Applications/MAMP/Library/logs/fastcgi
    FastCgiServer /Applications/MAMP/fcgi-bin/php7.2.1.fcgi -idle-timeout 3600
</IfModule>

Honestly, I am not too sure if the max_execution_time really helped, as it still failed to update until I changed the mod_fastcgi information.

@devkokov Thanks for pointing that out – fixed for the next release.

Was this page helpful?
0 / 5 - 0 ratings