craftcms / craftcms/cms

matrixcontent table not created when field added with project config

Open
#9,804 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

The matrixcontent table is not created while adding a new field with the project config.

Steps to reproduce
  1. Add a Matrix field with one block containing a simple text input
  2. The project config is modified
  3. Push the updated code on a server
  4. The server tries to create the field, but we get this error:
Applying changes from your project config files ...
- updating dateModified ... done
- adding matrixBlockTypes.0424aebf-bd00-4e38-b5f0-e903ef025386.fieldLayouts.fe7aac77-926f-4740-a3e6-eaa03b33c9f4.tabs.0.elements.0 ... 
  - adding matrixBlockTypes.0424aebf-bd00-4e38-b5f0-e903ef025386 ... done
  done
- adding matrixBlockTypes.0424aebf-bd00-4e38-b5f0-e903ef025386.fieldLayouts.fe7aac77-926f-4740-a3e6-eaa03b33c9f4.tabs.0 ... done
- adding matrixBlockTypes.0424aebf-bd00-4e38-b5f0-e903ef025386.fields.58bc240a-ef6b-4a82-80db-93d4195df51e.settings ... done
- adding matrixBlockTypes.0424aebf-bd00-4e38-b5f0-e903ef025386.fields.58bc240a-ef6b-4a82-80db-93d4195df51e ... done
- adding fields.bcadc7af-2d6f-4ab3-9eae-780095dc5796.settings ... 
  - adding fields.bcadc7af-2d6f-4ab3-9eae-780095dc5796 ... done
  done
error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'arto-galleria.craft_matrixcontent_test2' doesn't exist
The SQL being executed was: ALTER TABLE `craft_matrixcontent_test2` ADD `field_product_heading_jdfaldxh` text

I tried many times, we always get the same results.

Additional info
  • Craft version: 3.7.11
  • PHP version: 7.4.16
  • Database driver & version: MySQL 5.7 on server, and 8.0 on local machine
  • Plugins & versions:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing project-config field creation with the reported MySQL setup and inspect the schema-creation step before the ALTER TABLE operation. The fix is complete when the matrixcontent table exists before the new field column is added and the project config applies successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.