craftcms / craftcms/cms

Changing a field from Matrix to another fieldtype orphans the matrix table and elements

Open
#4,736 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

I switched a matrix field to a plaintext field (I was actually trying to switch the field because the matrix field wouldn't delete, but that's another story).

I ended up deleting the field as a plaintext field and the matrix table did not delete.

I tried re-creating the field as a matrix and deleting again and the table is still there.

Steps to reproduce
  1. Create a Matrix field.
  2. Switch the Matrix field to a Plaintext field.
  3. Check the database, the matrix table and elements still exist in the database.
Additional info
  • Craft version: 3.2.8
  • PHP version: 7.2
  • Database driver & version: Maria DB

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

No source file or test is named in the report. Reproduce the three listed steps on Craft 3.2.8 with MariaDB, then check the database as described; done means changing a Matrix field to Plaintext no longer leaves the Matrix table or elements behind.

Written by the indexing model from the issue text.

Assessment

Tech stack
mariadb, php
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.