[development] schema API add column after

Nancy Wichmann nan_wich at bellsouth.net
Mon Jun 9 18:43:16 UTC 2008

Matej Svetlík wrote:

> why do you need to have table column at specified position?

I was trying to keep quiet, even though I have this same issue, but I can't

Think about a new installation as opposed to an updated ("add column")

In the new installation, my schema says the columns come in the order, a, b,
c, etc. but let's say we now want to add column d. For a new installation,
it would look nicer to have it between b and c. The hook_schema can be done
this way. But how does one tell MySql that we want it between b and c?  In
straight MySql, this is easy with the "AFTER COLUMN ..." cause.

So, now you're going to ask, "What do you mean by 'it would look nicer'?"
So I'll give you an example that I'm actually working on right now. I have a
node extension table that has nid, vid, name, and more text fields. I am
changing the name column from text to integer so that it can point to new
table.  I really prefer to keep integer columns (pointers) together. And, in
this case, I am replacing one column with another (add new column, insert
data, delete old column), so it would be nice to have the new column be in
the "same place" the old one was before the update.

Make sense?

-------------- next part --------------

No virus found in this outgoing message.
Checked by AVG. 
Version: 8.0.100 / Virus Database: 270.1.0/1492 - Release Date: 6/9/2008 10:29 AM

More information about the development mailing list