Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL error while update to 3 from 2.6.2960 #1347

Closed
Bronskiy opened this issue Feb 4, 2017 · 20 comments
Closed

SQL error while update to 3 from 2.6.2960 #1347

Bronskiy opened this issue Feb 4, 2017 · 20 comments
Assignees
Labels
bug severity:normal Bugs that affect typical usage

Comments

@Bronskiy
Copy link

Bronskiy commented Feb 4, 2017

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
@SamLNL
Copy link

SamLNL commented Feb 6, 2017

Same problem here

@brandonkelly
Copy link
Member

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.

@Bronskiy
Copy link
Author

Bronskiy commented Feb 7, 2017

Just try to upgrade even fresh install Craft version: 2.6.2960

@angrybrad angrybrad reopened this Feb 7, 2017
@angrybrad angrybrad self-assigned this Feb 7, 2017
@SamLNL
Copy link

SamLNL commented Feb 7, 2017

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: SELECT versionASname, applyTimeFROMcraft_migrationsWHEREpluginIdIS NULL ORDER BYname DESC

@brandonkelly
Copy link
Member

@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].

brandonkelly added a commit that referenced this issue Feb 7, 2017
@angrybrad
Copy link
Member

@Bronskiy @SamLNL I'm 80% confident this fixes this issue: 2957f39

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

@angrybrad angrybrad added severity:normal Bugs that affect typical usage and removed environmental labels Feb 7, 2017
@angrybrad
Copy link
Member

And there is it: https://github.com/craftcms/cms/blob/master/CHANGELOG-v3.md#300-beta3---2017-02-07

@Bronskiy
Copy link
Author

Bronskiy commented Feb 8, 2017

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

@SamLNL
Copy link

SamLNL commented Feb 8, 2017

Same.

I also sent my error to Pixel & Tonic.

@Bronskiy
Copy link
Author

Bronskiy commented Feb 8, 2017

FYI I'm using serverpilot.io environment

@Bronskiy
Copy link
Author

Bronskiy commented Feb 8, 2017

@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.

@angrybrad
Copy link
Member

Responded to both of your support tickets.

how can I update beta 2 to beta 3

@Bronskiy just run composer update

@Bronskiy
Copy link
Author

Bronskiy commented Feb 9, 2017

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

@mxkxf
Copy link

mxkxf commented Jan 27, 2018

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

@DZuz14
Copy link

DZuz14 commented Apr 3, 2018

Having this issue...

@brandonkelly
Copy link
Member

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

@devkokov
Copy link

Same problem here

@devkokov
Copy link

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}

@DZuz14
Copy link

DZuz14 commented Jun 11, 2018

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.

@brandonkelly
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug severity:normal Bugs that affect typical usage
Projects
None yet
Development

No branches or pull requests

7 participants