WordPress.org

Make WordPress Core

Opened 9 months ago

#46145 new defect (bug)

dbDelta runs same updates on every execution

Reported by: janjakes Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Database Keywords:
Focuses: Cc:
PR Number:

Description

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.

Change History (0)

Note: See TracTickets for help on using tickets.