[wp-trac] [WordPress Trac] #12832: Use the same data type for site statuses

WordPress Trac noreply at wordpress.org
Sun Sep 15 05:43:26 UTC 2013


#12832: Use the same data type for site statuses
--------------------------------------+-----------------------
 Reporter:  ocean90                   |       Owner:  database
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  3.7
Component:  Database                  |     Version:  3.0
 Severity:  normal                    |  Resolution:
 Keywords:  needs-patch dev-feedback  |
--------------------------------------+-----------------------

Comment (by nacin):

 Replying to [comment:18 pento]:
 > It doesn't. When an ENUM converts to an INT, it returns the ENUM index,
 not the `CAST(... AS INT)` value of the ENUM. In the case of the
 `archived` column, ENUM '0' has an index of 1, and ENUM '1' has an index
 of 2.

 That's what I assumed.

 > We could totally convert it to VARCHAR in 3.7, then INT in 3.8, though.

 Unfortunately, we can't do a two-step like that. The upgrade routine is
 designed to work in layers, version by version, such that you could
 upgrade across many major versions at once and still be OK. The schemas +
 dbDelta() wouldn't know, of course, that one needs to do a double switch.

 [attachment:12832.diff] tries doing this in one shot, in
 pre_schema_upgrade(). It actually bypasses dbDelta entirely, by doing both
 ALTER queries at the same time.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/12832#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list