<blockquote>
  <p>Does a migration need to be written to account for this change?</p>
</blockquote>

<p>Yes.</p>

<blockquote>
  <p>how would this be written since it is the specific input name that is added to the content table?</p>
</blockquote>

<p>Just thinking out loud:</p>

<ul>
<li><p>Select all fields from the database that have your field type.</p></li>
<li><p>Determine if they are in a Matrix context (<code>craft_matrixHandleContent</code>) a global context (<code>craft_content</code>).</p></li>
<li><p>For each grab their handles and build the column name.</p></li>
<li><p>Alter table to add the column to the appropriate table.</p></li>
</ul>

CC BY-SA 3.0
2016-02-03T20:06:43.293Z
2016-02-03T20:06:43.293Z
Brad Bell
<p>My plugin's FieldType was initially setup with <code>defineContentAttribte</code> set to false.  I and switching it to <code>AttributeType::Mixed</code>. Does a migration need to be written to account for this change? If so how would this be written since it is the specific input name that is added to the content table?</p>

<plugin-development>
Is a migration needed if defineContentAttribute is changed from false to an AttributeType
# Is a migration needed if defineContentAttribute is changed from false to an AttributeType

(Asked by: username_0 on 2016-02-03)

My plugin's FieldType was initially setup with `defineContentAttribte` set to false. I and switching it to `AttributeType::Mixed`. Does a migration need to be written to account for this change? If so how would this be written since it is the specific input name that is added to the content table?

**Tags:** plugin-development


---

## 1 answers

### Answer by username_1 on 2016-02-03. Score: 2 | Accepted answer

> Does a migration need to be written to account for this change?

Yes.

> how would this be written since it is the specific input name that is added to the content table?

Just thinking out loud:

* Select all fields from the database that have your field type.
* Determine if they are in a Matrix context (`craft_matrixHandleContent`) a global context (`craft_content`).
* For each grab their handles and build the column name.
* Alter table to add the column to the appropriate table.


---

