[wp-trac] [WordPress Trac] #55942: Add a "type" field to the meta and options tables

WordPress Trac noreply at wordpress.org
Wed Jul 20 21:40:28 UTC 2022


#55942: Add a "type" field to the meta and options tables
-------------------------+---------------------
 Reporter:  azaozz       |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  6.1
Component:  Database     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  2nd-opinion  |     Focuses:
-------------------------+---------------------

Comment (by azaozz):

 Replying to [comment:7 barry.hughes]:
 > Also a little on the fence, though I think I'm still leaning toward
 enums (memory efficient, good query readability, stricter than a plain
 integer).

 Yep, thinking more about it, lets go with the built-in `ENUM()`. Nothing
 beats simplicity :)

 > > In addition to the defined values there always are '' (mapped to 0)
 and NULL. That may be somewhat confusing.
 >
 > I think one part of this can be avoided completely, by making the column
 non-nullable.

 You're right. Thinking it may still be needed though, depends on how the
 patch is going to handle stuff like `add_option( 'my_option', NULL )` and
 what would be the expected return there considering back-compat.

 > Though ... I'm a little unsure if we actually *do* want plugins to be
 able to interact at this level

 Yeah, perhaps better to not let plugins interact there. If any interaction
 is needed it can probably be done at a higher level, i.e. make an
 associative array or an object, add all info (including any meta that may
 be needed), then encode and pass to the WP API as a string.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55942#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list