craftcms / cms

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

Renaming fields in matrix blocks issue #3341

Open billythekid opened 6 years ago

billythekid commented 6 years ago

Description

There's a bug in matrix where renaming fields can get a mySQL error under specific circumstances. (possibly not restricted to matrix fields this but that's just where I've experienced it)

Steps to reproduce

  1. create a matrix field and add a block type
  2. create 2 plain text fields in the block, name one heading and one description and save the field
  3. edit the field and rename the first field to description and the second to anything else (rename the field handles too)
  4. the error is that the column matrix_blocktype__description exists already (which of course it does) however we're actually renaming that column too at the same time.

The workaround of course is to rename them one at a time to avoid this collision.

brandonkelly commented 6 years ago

What version of Craft are you running?

billythekid commented 6 years ago

Sorry:

Additional info

brandonkelly commented 6 years ago

Thanks. Guess this is a good case for including field IDs in the column names. Realistically not something we can fix until 4.0 though, as changing the column name format would break sites that have manually defined SQL queries.