[development] D6 SAPI: using hook_install to ALTER {tables}
Derek Wright
drupal at dwwright.net
Thu Dec 27 10:44:59 UTC 2007
On Dec 27, 2007, at 12:15 AM, Augustin (Beginner) wrote:
> Q3) Is it considered best practice to create your own tables rather
> than adding fields to existing tables "belonging" to other modules?
definitely! the other module might alter the schema and your data
could be destroyed.
for example, sometimes, the best way to add a new (computed) column
is to create a new table with the schema you need, populate it with
fancy SELECT logic, and then drop the old one[1]. if your contrib
has hidden its own columns in the original table, the author of the
schema update won't know about your columns and will blindly drop all
your data after safely migrating their own columns to the new table.
-derek (dww)
[1] see for example, http://drupal.org/node/203313
http://drupal.org/files/issues/project_203313_releases_table.patch_5.txt
function project_release_update_5200()
More information about the development
mailing list