Greetings all,
I’m creating my first add-on, and it needs to have a database table associated with it. I was going to make it a simple Plug-In, but it appears that I may need to make it an Accessory rather than a plug-in if I need a database table. The table will need to be created when the add-on is installed and deleted when the add-on is uninstalled.
Can someone please confirm that I need an Accessory rather than a Plug-in in order to accomplish this? Also, I’m wondering what other differences there are between these two add-on types. I’ve read over the docs here and here but it’s not clear to me if the option of a setup/install/uninstall is the main difference or if there are other important differences.
If I should be posting questions like these somewhere else, please let me know.
Thanks for your help,
Moved to Development and Programming by Moderator -NorthK
Hi NorthK
The table will need to be created when the add-on is installed and deleted when the add-on is uninstalled. Can someone please confirm that I need an Accessory rather than a Plug-in in order to accomplish this?
That alone says a lot. Plugins never need to be “installed”. They only need to be put in the right folder on your server. So, with what you’ve said so far I’d recommend an Accessory over a Plugin if those are the two options.
Also, I’m wondering what other differences there are between these two add-on types. I’ve read over the docs here and here but it’s not clear to me if the option of a setup/install/uninstall is the main difference or if there are other important differences.
Accessories are little tabs in the footer area of your Control Panel. You might not even need one of those in this case. If you literally just need a database table with some data in it I’d suggest you make your add-on a Module. That will give you 99% of what a Plugin gives you AND the ability to setup a database table on install.
Take a look at the module tutorial and see if that sounds like a doable thing to you.
If I should be posting questions like these somewhere else, please let me know.
Sue has brought you to the right place. Add-on questions are mostly best served here in the Development and Programming forum.
Let me know what you think about the information above and if you have any questions about how to get started.
Erik
Hi again Erik,
For my add-on, the database is only used for one table that caches XML data received from REST calls (Twitter in this case). I’d like to use the database since it will nicely handle concurrency rather than going with a file-based cache, which can have a lot of issues.
It looks like there may be quite a bit of stuff involved in creating a module, which I won’t need. The only CP option will be Install or Uninstall so it can create the DB table. Otherwise, no control panel additions, nothing needed on the Publish page, no view files needed. Just tags, tag parameters and one DB table.
I’m wondering if this information would change your answer or not?
Thanks, -NorthK
I’m wondering if this information would change your answer or not?
Nope 😊
I’d stick with the module approach which would mean you’d need something like the following in terms of files:
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.