[wp-hackers] Help with dbDelta
Chris Williams
chris at clwill.com
Wed Jan 26 16:11:57 UTC 2011
In my experience dbdelta only really works to add fields/tables as you
have noted, but it does not support or handle field renames, type changes,
or eliminations. To answer your questions, I think it is generally the
accepted method for table addition/update, but that custom update code is
required in cases outside that scenario.
On 1/26/11 7:34 AM, "Mike Walsh" <mike_walsh at mindspring.com> wrote:
>I have a plugin that manages a swim team that I've developed over the last
>couple years. It uses some custom tables to store all of the swim team
>information. I've used dbDelta() to create the tables in the past (based
>on
>recommendations from the CodeEx and this list) and it has worked fine for
>new tables or new columns in existing tables. Yesterday I realized that
>one
>of the tables had a mistake in it due to a typo. I fixed it and changed
>the
>database version number of use for checking and dbDelta() did not update
>the
>table as I expected. My question is this:
>
>Is dbDelta() still the suggested method for creating and updating custom
>tables?
>What is the best way to check for and handle problems when dbDelta() does
>not update a table?
>
>Thanks,
>
>Mike
>
>--
>Mike Walsh - mike underscore walsh at mindspring dot com
>
>
More information about the wp-hackers
mailing list