[development] (no subject)
pierre.rineau at makina-corpus.com
Mon Jul 12 18:18:32 UTC 2010
Le lundi 12 juillet 2010 à 13:27 -0400, Earnie Boyd a écrit :
> Pierre Rineau wrote:
> > Le lundi 12 juillet 2010 à 09:19 -0700, nan wich a écrit :
> >> Is there an official stance on using hook_schema_alter to add columns
> >> to core tables? For example, we collect additional data on anonymous
> >> comments and want to actually save that data. Rather than creating
> >> another table (and subsequent JOINs), I'd just as soon stuff that data
> >> into the comments table, where it belongs. Should we ever disable
> >> comments (unlikely), we probably wouldn't mind losing that data too.
> >> Nancy E. Wichmann, PMP
> >> Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L.
> >> King, Jr.
> > I would say, create a new table instead of populating core one.
> I would create a new table as well. The problem with modifying the core
> table is you never know if there will be a column added to it that
> matches a name you've chosen and if you add prefixes/suffixes to help
> namespace the column it becomes annoyingly long.
More than that, if all modules would have done that, we'd probably all
suffer from name conflicts from one module to another.
Too much database alteration is not that good, keeping stuff separated
on many tables can be such a mess for an external eye, but it keeps a
clean encapsulation and can be a lot faster.
Don't be afraid of JOIN, SQL has been done for this, just don't forget
to put the right indexes and all will play nicely. The less you update
other's tables (and the more small are the table you update) the less
you will suffer from ineffective query cache and tables growing insanely
(once I dealt a 8GB watchdog table because of a missing cron run, and
most DBMS will allocate the size for it, but won't be able to unallocate
it, which can be really problematic for the underlying FS).
More information about the development