WPDB
objects.dbDelta
function examines the current table structure, compares it to the desired table structure, and either adds or modifies the table as necessary, so it can be very handy for updates.dbDelta
function is rather picky, however. For instance:PRIMARY KEY
and the definition of your primary key.KEY
rather than its synonym INDEX
and you must include at least one KEY.CREATE TABLE
must be capitalised.