I have developed a wordpress plugin , i am planning to update the plugin.
In the plugin updation process i want to update the already exist tables fields which is created when plugin activated . I want when the user update the plugin then the new field added to already exist table with default value. Can you please suggest me a method how i achieve this.
I have developed a wordpress plugin , i am planning to update the plugin.
Share
You should be investigating the
dbDeltafunction. Here’s the link http://codex.wordpress.org/Creating_Tables_with_Plugins#Creating_or_Updating_the_TableFrom the Codex:
The 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 (see wp-admin/upgrade-schema.php for more examples of how to use dbDelta).