<p>If you want to change database schema after a plugin has already been installed, the way to do it is through <a href="https://craftcms.com/docs/plugins/migrations" rel="nofollow noreferrer">migrations</a>.</p>

<p>You can see many examples of this in Craft in the <code>craft/app/migrations</code> folder.</p>

CC BY-SA 3.0
2016-12-12T23:03:43.167Z
Oh you have migrations built right into your plugin system! That's so clever I didn't think to check for it! Thanks Brad!
JamesNZ
CC BY-SA 3.0
2016-12-12T22:41:43.240Z
2016-12-12T22:41:43.240Z
Brad Bell
<p>If you have a plugin installed with its own tables and you want to add some extra database fields to the table, what is the process for this?</p>

<p>Craft will create database tables using records on installation of the plugin, but what about after this? If I update the record definitions is there a way to trigger Craft to update the table or do I have to add the fields through MySQL?</p>

CC BY-SA 3.0
2016-12-12T23:04:11.293Z
Following on from Brad's answer, here's a link to the docs for migrations: https://craftcms.com/docs/plugins/migrations
JamesNZ
<plugin-development><plugins><records><mysql>
Update record definition after plugin is already installed
# Update record definition after plugin is already installed

(Asked by: username_0 on 2016-12-12)

If you have a plugin installed with its own tables and you want to add some extra database fields to the table, what is the process for this?

Craft will create database tables using records on installation of the plugin, but what about after this? If I update the record definitions is there a way to trigger Craft to update the table or do I have to add the fields through MySQL?

**Tags:** plugin-development, plugins, records, mysql
> **Comments:**
> **username_0**: Following on from Brad's answer, here's a link to the docs for migrations: https://craftcms.com/docs/plugins/migrations  

---

## 1 answers

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

If you want to change database schema after a plugin has already been installed, the way to do it is through [migrations](https://craftcms.com/docs/plugins/migrations).

You can see many examples of this in Craft in the `craft/app/migrations` folder.

> **Comments:**
> **username_0**: Oh you have migrations built right into your plugin system! That's so clever I didn't think to check for it! Thanks Brad!  

---

