Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2006-07-11 20:27:10
- plummerm
- Archived Plugin Author
- Registered: 2006-06-19
- Posts: 22
plugin db best practices?
Hello all,
I’m working on a plugin to extend sections to have functionality similar to categories/subcategories. I know that categories can be used in conjunction with sections to make a hierarchy, but my project has other needs for the categories, making that solution undesirable.
Anyway, I need a couple extra fields for the section table. Thinking that it would keep things cleaner through Textpattern upgrades, I created my own table to extend txp_section.
However, I noticed that most txp db functions use only one table queries with no joins (possibly for better performance?). In that light, what is the “best practice” for plugins that require changes to the database- a separate table unassociated with original txp tables, or a modified txp table?
thanks for your time,
Matt
Offline
Re: plugin db best practices?
I do my best to use new tables since it eliminates any future name collisions. There are times when a separate table does not make sense, but that is up the the plugin developer to decide.
Offline
Re: plugin db best practices?
Coming from a non programmer, whatever you are planning, remember that some users have their sites in a sub directory or a sub domain :)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#4 2006-07-12 23:51:49
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: plugin db best practices?
Make sure if you create any new table, that you use the user-defined database table prefix, as well as using your plugin prefix in the table name. That way should a new version of Txp create a new table of that name, there won’t be a conflict and messy upgrade.
Offline
#5 2006-07-15 17:39:09
- plummerm
- Archived Plugin Author
- Registered: 2006-06-19
- Posts: 22
Re: plugin db best practices?
Thanks!!
Offline
Pages: 1