Automattic\WooCommerce\Internal\Email\Unsubscribes
Storage::get_database_schema
Database schema for the unsubscribes table.
Called from WC_Install::get_schema() so the table is created/updated alongside the rest of WC's tables on activate/upgrade.
Method of the class: Storage{}
No Hooks.
Returns
string. SQL CREATE TABLE statement.
Usage
$Storage = new Storage(); $Storage->get_database_schema(): string;
Storage::get_database_schema() Storage::get database schema code WC 11.1.2
public function get_database_schema(): string {
global $wpdb;
$table = $this->get_table_name();
$collate = $wpdb->has_cap( 'collation' ) ? $wpdb->get_charset_collate() : '';
return "CREATE TABLE {$table} (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
email_hash char(64) NOT NULL,
email_kind varchar(64) NOT NULL,
action varchar(20) NOT NULL,
created_at datetime NOT NULL,
PRIMARY KEY (id),
KEY email_hash_kind (email_hash, email_kind)
) {$collate};";
}