[wp-trac] [WordPress Trac] #46145: dbDelta runs same updates on every execution

WordPress Trac noreply at wordpress.org
Wed Jan 30 08:37:30 UTC 2019


#46145: dbDelta runs same updates on every execution
--------------------------+-----------------------------
 Reporter:  janjakes      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Given a SQL column with a definition such as:
 {{{
 created_at TIMESTAMP NULL
 }}}

 The dbDelta detects the following changes:
 {{{
 Changed type of table_name.created_at from timestamp to TIMESTAMP
 }}}

 But then executes a query using part of the original SQL:
 {{{
 ALTER TABLE table_name CHANGE COLUMN `created_at` created_at TIMESTAMP
 NULL
 }}}

 Which leads to the same changes being detected again on the next run. This
 applies not only to case of the type but to many other cases such as "int"
 vs. "int(11)", "bigint" vs. "bigint(20)", etc. This will actually happen
 in every case when the given SQL differs from the exact "expected" form.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/46145>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list