Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#4778 closed defect (bug) (fixed)

Change enums to varchar

Reported by: ryan Owned by:
Milestone: 2.5 Priority: high
Severity: normal Version: 2.3
Component: Administration Keywords: schema enum db early
Focuses: Cc:


Drop enums from the schema in favor of the more portable and flexible varchar. I think we can just change all occurrences of enum in schema.php to varchar(20). This will allow plugins to add new post status values, for example, without having to do an alter table to change the enum.

Attachments (1)

enum_to_varchar.diff (2.4 KB) - added by ryan 8 years ago.

Download all attachments as: .zip

Change History (10)

#1 @westi
8 years ago


This is a really good idea.

#2 @Otto42
8 years ago


This is a really bad idea. The whole point of using an enum is to have a fixed set of values that are valid ones. They are stored as integers internally and make things somewhat speedier, since WordPress selects posts based on post_status more or less constantly. Changing it to a varchar would create a not-insignificant performance loss.

If a plugin is making such a radical change as to require its own special post_status values, then it should be able to take the time to alter the table to allow that status.

#3 @ryan
8 years ago

Another motivator is to make our SQL more portable. enums aren't.

#4 @matt
8 years ago

+1 been meaning to do this for years.

#5 @foolswisdom
8 years ago

  • Milestone changed from 2.3 to 2.4 (next)
  • Priority changed from normal to high

#6 @foolswisdom
8 years ago

Mark and Ryan have decided to postpone this until 2.4, I have marked the priority is high so hopefully it can be done early in 2.4s cycle.

#7 @westi
8 years ago

  • Keywords early added

8 years ago

#8 @ryan
8 years ago

Change all enums to varchar(20)

#9 @ryan
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6732]) Enum to varchar. fixes #4778

Note: See TracTickets for help on using tickets.