[development] Best place to store user data
earnie at users.sourceforge.net
Tue Mar 17 12:10:50 UTC 2009
Quoting Moshe Weitzman <weitzman at tejasa.com>:
>> So let me add a bit to the question because I just came across it in a
>> contrib. Let's say you need one field that exactly matches a core table. Is
>> it ever okay, upgrades aside, to add that column to the core table? Some
>> things I've read about D7 seem to indicate this will be okay in D7. The use
>> of "drupal_write_record" really makes this a convenient practice.
> Depends on who you ask. My position is that adding a column to a
> foreign table is OK if the code will not be shared. IOW, custom code
> for your own site. It is especially OK for the user table since it has
> built in support for custom columns. I discourage this practice for
> Contrib modules since the users of the module are usually unprepared
> to evaluate the upgrade risks involved.
I agree with Moshe but understand the desire to want to add to a table.
The correct method for this is to create your own table relating the
rows of information. You can CREATE VIEW if you want to avoid needing
to supply the JOINS. Views are great for relating row ids to the text
data you wish to represent. Writing the relational data is reserved
for the provided hooks such as hook_nodeapi.
Make a Drupal difference and review core patches.
-- http://for-my-kids.com/ -- http://www.4offer.biz/
More information about the development