Make WordPress Core

Opened 12 years ago

Last modified 5 years ago

#20634 new enhancement

dbDelta is unforgiving about field declarations

Reported by: sidharrell's profile SidHarrell Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.5
Component: Database Keywords: has-patch dev-feedback
Focuses: Cc:


the variable type is case sensitive:
int(22) != INT(22)

the mysql type BOOL or BOOLEAN comes back from the db as tinyint(1):
tinyint(1) != BOOLEAN

Not a huge issue, just annoying. Makes dbDelta fire off unnecessary sql.

Attachments (3)

upgrade_1589.patch (1.3 KB) - added by SidHarrell 12 years ago.
upgrade_1651.patch (730 bytes) - added by SidHarrell 12 years ago.
upgrade_1571.patch (966 bytes) - added by SidHarrell 12 years ago.

Download all attachments as: .zip

Change History (11)

#1 @SidHarrell
12 years ago

Also annoying is the fact that in our schema, we have to put 2 spaces in between PRIMARY KEY and the (:


This one is more problematic, since the core schema is using the 2 space rule, which would be easy enough to fix with a search and replace, but the patch I have for it would also break every plugin out there that uses the 2 space rule.

Last edited 12 years ago by SidHarrell (previous) (diff)

#2 @SidHarrell
12 years ago

I fixed that second patch to allow for single or double spaces between PRIMARY KEY and the ( so


will work, but not break backwards compatibility with


#3 @scribu
12 years ago

+1 on the general idea.

Note that patch names should generally contain the ticket number, instead of some other arbitrary number.

Also, it's not clear which patches are meant to be final and which are just intermediary.

Last edited 12 years ago by scribu (previous) (diff)

#4 @SidHarrell
12 years ago

Sorry about that. I'm new to the whole process.

upgrade_1589.patch (I was referring to the file and line#, sorry) is the patch for the first issue, to do a case insensitive comparison of fieldnames and convert the synonyms for boolean to tinyint(1).

upgrade_1651.patch breaks backwards compatibility, so ignore that one.

upgrade_1571.patch allows for single or double spaces after PRIMARY KEY


Last edited 12 years ago by SidHarrell (previous) (diff)

#5 @nacin
12 years ago

  • Type changed from defect (bug) to enhancement
  • Version changed from 3.4 to 1.5

This was how dbDelta was originally designed. Setting as an enhancement.

#6 @chriscct7
9 years ago

  • Keywords dev-feedback added
  • Severity changed from minor to normal

@pento any thoughts?

#7 @pento
9 years ago

Before we even touch this, we need #29020 to land. :-)

This ticket was mentioned in Slack in #glotpress by ocean90. View the logs.

8 years ago

Note: See TracTickets for help on using tickets.