0

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?

1

1 Answer 1

2

If you want to change database schema after a plugin has already been installed, the way to do it is through migrations.

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

1
  • 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
    Commented Dec 12, 2016 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.