craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.21k stars 624 forks source link

[3.4] SQLSTATE[42S22]: Column not found: 1054 Unknown column 'config' in 'field list' #5522

Closed denisyilmaz closed 4 years ago

denisyilmaz commented 4 years ago

I got an internal server error with a fresh install on a staging server. I updated CraftCMS to 3.4.0.2 and Redactor to 3.5.0. Tested locally everything works fine.

On the staging server I get following error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'config' in 'field list'
The SQL being executed was: SELECT `config`
FROM `craft_info`
LIMIT 1 in /home/runcloud/webapps/craft-cms/vendor/yiisoft/yii2/db/Schema.php:674
Additional Information:
Array
(
    [0] => 42S22
    [1] => 1054
    [2] => Unknown column 'config' in 'field list'
)

I deleted the database and started from a empty Database, but still, after the installation process the installation fails with this error.

image

Steps to reproduce

Additional Information

Installed Plugins

"require": {
    "aelvan/imager": "v2.3.1",
    "craftcms/cms": "^3.0.0",
    "craftcms/redactor": "2.5.0",
    "vlucas/phpdotenv": "^3.4.0"
  }
andris-sevcenko commented 4 years ago

@denisyilmaz can you send over your project.yaml file as well as composer.lock and composer.json files to support@craftcms.com for the environment where the fresh install is failing? Also, please, reference this issue in the email :)

denisyilmaz commented 4 years ago

Done

wouter-vs commented 4 years ago

I'm getting the same error when upgrading from 3.3.20.1 to 3.4.0

Installed plugins

  "require": {
    "craftcms/cms": "3.4.0",
    "vlucas/phpdotenv": "^2.4.0",
    "ether/logs": "3.0.3",
    "adigital/cookie-consent-banner": "1.2.5",
    "ether/seo": "^3.5.4",
    "aelvan/imager": "v2.3.1",
    "verbb/field-manager": "2.1.1",
    "mmikkel/incognito-field": "^1.1.1.1",
    "craftcms/redactor": "^2.3.2",
    "clubstudioltd/craft-asset-rev": "^6.0",
    "superbig/craft3-http2serverpush": "^1.0",
    "studioespresso/craft-dumper": "^2.0.0",
    "elivz/craft-single-cat": "^1.2.1",
    "fruitstudios/linkit": "^1.1.11",
    "putyourlightson/craft-entry-count": "^2.0.2",
    "liftov/newsletter-subscribe": "^1.0",
    "verbb/navigation": "1.2.7",
    "liftov/migration": "^1.0",
    "xpertbot/craft-wheelform": "^2.2.1",
    "liftov/craft-stage-file-proxy": "^1.0",
    "liftov/like": "2.0",
    "dukt/social": "^2.0",
    "dukt/social-linkedin": "^3.0.4",
    "twentyfourhoursmedia/comments-work": "^1.0.5",
    "liftov/keyword-analyzer": "^1.0",
    "craftcms/feed-me": "4.2.0.1",
    "cedx/yii2-json-messages": "^5.2",
    "nystudio107/craft-seomatic": "3.2.39",
    "dolphiq/redirect": "^1.0.23",
    "storychief/storychief-v3": "1.0.3",
    "liftov/storychief-parser": "^1.0",
    "sunra/php-simple-html-dom-parser": "^1.5",
    "craftcms/element-api": "^2.6.0"
  },
andris-sevcenko commented 4 years ago

@Moskydesign if you update to at least 3.4.0.1 (https://github.com/craftcms/cms/issues/5391#issuecomment-579452797) it all should work!

wouter-vs commented 4 years ago

@andris-sevcenko that seems to work, "skipping" 3.4.0 and going directly to 3.4.0.1 or 3.4.0.2

brandonkelly commented 4 years ago

This error only seems to occur after another error occurs on the initial update attempt.

If you get it, do the following:

  1. Revert your database to a backup that was created before updating to 3.4. (By default, Craft will create database backups before each update, and save them to storage/backups/. Note that the backup file will likely include the 3.4 version, as Craft 3.4 would have been Composer-installed by the time the backup was actually created, though before the migrations had been attempted.)

  2. Open composer.json and change your craftcms/cms requirement to ^3.4.0.2, and then run composer update, just to be sure you’ve got the latest 3.4 release.

  3. Finally, re-attempt the update, either from the control panel, or by running ./craft migrate/all.

If the migrations fail again, then please send your pre-update DB backup, as well as your composer.json and composer.lock files, over to support@craftcms.com, so we can look into it.

BSBjorn commented 4 years ago

I'm getting this issue when updating from 3.4.24 > 3.4.28.1, tried downgrading to a backup but the issue persist...

brandonkelly commented 4 years ago

@BSBjorn Search for the error in your storage/logs/ folder and post the stack trace that follows it.

BSBjorn commented 4 years ago

@brandonkelly heres from console.log

2020-07-21 06:54:22 [-][-][-][warning][craft\db\mysql\Schema::releaseSavepoint] Tried to release a savepoint, but it does not exist: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT LEVEL1 does not exist
The SQL being executed was: RELEASE SAVEPOINT LEVEL1
2020-07-21 06:54:22 [-][-][-][info][craft\db\MigrationManager::migrateUp] Applied m200715_113400_transform_index_error_flag (time: 0.017s).
2020-07-21 06:54:22 [-][-][-][info][yii\db\Command::query] SHOW FULL COLUMNS FROM `migrations`
2020-07-21 06:54:22 [-][-][-][profile begin][yii\db\Command::query] SHOW FULL COLUMNS FROM `migrations`
2020-07-21 06:54:22 [-][-][-][profile end][yii\db\Command::query] SHOW FULL COLUMNS FROM `migrations`
2020-07-21 06:54:22 [-][-][-][info][yii\db\Command::query] SELECT
    `kcu`.`CONSTRAINT_NAME` AS `constraint_name`,
    `kcu`.`COLUMN_NAME` AS `column_name`,
    `kcu`.`REFERENCED_TABLE_NAME` AS `referenced_table_name`,
    `kcu`.`REFERENCED_COLUMN_NAME` AS `referenced_column_name`,
    `rc`.`DELETE_RULE`,
    `rc`.`UPDATE_RULE`
FROM `information_schema`.`REFERENTIAL_CONSTRAINTS` AS `rc`
JOIN `information_schema`.`KEY_COLUMN_USAGE` AS `kcu` ON
    (
        `kcu`.`CONSTRAINT_CATALOG` = `rc`.`CONSTRAINT_CATALOG` OR
        (`kcu`.`CONSTRAINT_CATALOG` IS NULL AND `rc`.`CONSTRAINT_CATALOG` IS NULL)
    ) AND
    `kcu`.`CONSTRAINT_SCHEMA` = `rc`.`CONSTRAINT_SCHEMA` AND
    `kcu`.`CONSTRAINT_NAME` = `rc`.`CONSTRAINT_NAME`
WHERE `rc`.`CONSTRAINT_SCHEMA` = database() AND `kcu`.`TABLE_SCHEMA` = database()
AND `rc`.`TABLE_NAME` = 'migrations' AND `kcu`.`TABLE_NAME` = 'migrations'
2020-07-21 06:54:22 [-][-][-][profile begin][yii\db\Command::query] SELECT
    `kcu`.`CONSTRAINT_NAME` AS `constraint_name`,
    `kcu`.`COLUMN_NAME` AS `column_name`,
    `kcu`.`REFERENCED_TABLE_NAME` AS `referenced_table_name`,
    `kcu`.`REFERENCED_COLUMN_NAME` AS `referenced_column_name`,
    `rc`.`DELETE_RULE`,
    `rc`.`UPDATE_RULE`
FROM `information_schema`.`REFERENTIAL_CONSTRAINTS` AS `rc`
JOIN `information_schema`.`KEY_COLUMN_USAGE` AS `kcu` ON
    (
        `kcu`.`CONSTRAINT_CATALOG` = `rc`.`CONSTRAINT_CATALOG` OR
        (`kcu`.`CONSTRAINT_CATALOG` IS NULL AND `rc`.`CONSTRAINT_CATALOG` IS NULL)
    ) AND
    `kcu`.`CONSTRAINT_SCHEMA` = `rc`.`CONSTRAINT_SCHEMA` AND
    `kcu`.`CONSTRAINT_NAME` = `rc`.`CONSTRAINT_NAME`
WHERE `rc`.`CONSTRAINT_SCHEMA` = database() AND `kcu`.`TABLE_SCHEMA` = database()
AND `rc`.`TABLE_NAME` = 'migrations' AND `kcu`.`TABLE_NAME` = 'migrations'
2020-07-21 06:54:22 [-][-][-][profile end][yii\db\Command::query] SELECT
    `kcu`.`CONSTRAINT_NAME` AS `constraint_name`,
    `kcu`.`COLUMN_NAME` AS `column_name`,
    `kcu`.`REFERENCED_TABLE_NAME` AS `referenced_table_name`,
    `kcu`.`REFERENCED_COLUMN_NAME` AS `referenced_column_name`,
    `rc`.`DELETE_RULE`,
    `rc`.`UPDATE_RULE`
FROM `information_schema`.`REFERENTIAL_CONSTRAINTS` AS `rc`
JOIN `information_schema`.`KEY_COLUMN_USAGE` AS `kcu` ON
    (
        `kcu`.`CONSTRAINT_CATALOG` = `rc`.`CONSTRAINT_CATALOG` OR
        (`kcu`.`CONSTRAINT_CATALOG` IS NULL AND `rc`.`CONSTRAINT_CATALOG` IS NULL)
    ) AND
    `kcu`.`CONSTRAINT_SCHEMA` = `rc`.`CONSTRAINT_SCHEMA` AND
    `kcu`.`CONSTRAINT_NAME` = `rc`.`CONSTRAINT_NAME`
WHERE `rc`.`CONSTRAINT_SCHEMA` = database() AND `kcu`.`TABLE_SCHEMA` = database()
AND `rc`.`TABLE_NAME` = 'migrations' AND `kcu`.`TABLE_NAME` = 'migrations'
2020-07-21 06:54:22 [-][-][-][info][yii\db\Command::execute] INSERT INTO `migrations` (`type`, `pluginId`, `name`, `applyTime`, `dateCreated`, `dateUpdated`, `uid`) VALUES ('app', NULL, 'm200715_113400_transform_index_error_flag', '2020-07-21 04:54:22', '2020-07-21 04:54:22', '2020-07-21 04:54:22', 'c068147a-c576-4f46-a3d8-c464832dd81b')
2020-07-21 06:54:22 [-][-][-][profile begin][yii\db\Command::execute] INSERT INTO `migrations` (`type`, `pluginId`, `name`, `applyTime`, `dateCreated`, `dateUpdated`, `uid`) VALUES ('app', NULL, 'm200715_113400_transform_index_error_flag', '2020-07-21 04:54:22', '2020-07-21 04:54:22', '2020-07-21 04:54:22', 'c068147a-c576-4f46-a3d8-c464832dd81b')
2020-07-21 06:54:22 [-][-][-][profile end][yii\db\Command::execute] INSERT INTO `migrations` (`type`, `pluginId`, `name`, `applyTime`, `dateCreated`, `dateUpdated`, `uid`) VALUES ('app', NULL, 'm200715_113400_transform_index_error_flag', '2020-07-21 04:54:22', '2020-07-21 04:54:22', '2020-07-21 04:54:22', 'c068147a-c576-4f46-a3d8-c464832dd81b')
2020-07-21 06:54:22 [-][-][-][info][craft\db\MigrationManager::up] Migrated up successfully.
BSBjorn commented 4 years ago

@brandonkelly I have this working now.. I tried a different DB and got it working with the update, only difference is that i did a Craft CMS update first, then the rest of the plugins as a seperate step, is that "best practice" or dosn't it matter in what order I do it?

brandonkelly commented 4 years ago

@BSBjorn I don’t see any mention of Unknown column 'config' in those logs.

The order usually shouldn’t matter, since plugins that require more recent Craft versions should be saying so in their craftcms/cms requirement.

DarioDiGiacomo commented 3 months ago

image

I've also have this problem semi too..

It is not the same problem, but it's close

My plan was to upgrade from CraftCMS 4 to 5, but the instructions were a bit scary so my second option was to make a complete new Craft Project, I used the same DB as the first project and since then i get this error.

brandonkelly commented 3 months ago

@DarioDiGiacomo Can you send a database backup and your Composer files into support@craftcms.com?