(See #2256 for the original issue & discussion when this table was introduced.)
id bigint(20) NOT NULL AUTO_INCREMENT,
user_id bigint(20) NOT NULL,
email varchar(50) NOT NULL,
name mediumtext NOT NULL,
purchase_value mediumtext NOT NULL,
purchase_count bigint(20) NOT NULL,
payment_ids longtext NOT NULL,
notes longtext NOT NULL,
date_created datetime NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY email (email),
KEY user (user_id)
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
user_id bigint(20) unsigned NOT NULL default '0',
email varchar(100) NOT NULL default '',
name mediumtext NOT NULL default '',
purchase_value mediumtext NOT NULL,
purchase_count bigint(20) unsigned NOT NULL default '0',
payment_ids longtext NOT NULL default '',
date_created datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (id),
UNIQUE KEY email (email),
KEY user (user_id)
bigint's unsigned because negative numbers should not be allowed in thememail from 50 to 100 to match what's now in wp_edd_ordersNOT NULLdate_created that is a properly formatted empty date stringnotes column, which we can move to wp_edd_notes with a customer note type and IDI noticed that wp_edd_customermeta has an un'prefixed customer_id column. This should now be edd_customer_id to avoid collisions and bugs with _get_meta_table() and to be brought up to speed with other work going into EDD3.
Remove the notes column, which we can move to wp_edd_notes with a customer note type and ID
This will require an upgrade routine to migrate existing notes over.
We should also remove the payment_ids column because the new edd_orders table will store a customer_id linking the two together nicely.
The current method also isn't best when deleting payments - we need to search the array to remove the payment ID (not very efficient if a customer has, say 1,000 orders) and then update the DB.
We'll need an upgrade routine that alters the name of the meta column from customer_id to edd_customer_id.
we'll also need an upgrade routine to handle the customer record re-creation for purcahses that had an email address over 50 characters, as the payment would have been successful, but the customer would not have been created.
Merged.
Most helpful comment
We should also remove the
payment_idscolumn because the newedd_orderstable will store acustomer_idlinking the two together nicely.The current method also isn't best when deleting payments - we need to search the array to remove the payment ID (not very efficient if a customer has, say 1,000 orders) and then update the DB.