[wp-trac] [WordPress Trac] #41335: dbDelta() does not recognize MySQL's IF NOT EXISTS statement

WordPress Trac noreply at wordpress.org
Sun Jul 16 02:17:23 UTC 2017


#41335: dbDelta() does not recognize MySQL's IF NOT EXISTS statement
-----------------------------------------+------------------------------
 Reporter:  kmaxim                       |       Owner:
     Type:  enhancement                  |      Status:  new
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Upgrade/Install              |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |     Focuses:
-----------------------------------------+------------------------------
Changes (by pento):

 * keywords:  has-patch => has-patch reporter-feedback
 * version:  4.8 =>
 * type:  defect (bug) => enhancement


Comment:

 Thank you for the feature request, @kmaxim!

 Do you have a particular use case for this? `dbDelta()` generally doesn't
 need to support `IF NOT EXISTS`, because the function checks to see if the
 table exists, then decides whether it needs to create the table, or modify
 it to match the `CREATE TABLE` statement passed to it.

 If you pass `dbDelta()` the same `CREATE TABLE` statement twice, it will
 do nothing the second time, as the table exists, and there are no changes
 to be made.

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


More information about the wp-trac mailing list