/** * Create table sharing reports. * * @since 1.1 * @global $wpdb * @param Null * @global $wpdb * @return Void */ public function create_table() { global $wpdb; $charset = $wpdb->get_charset_collate(); $table_name = $wpdb->prefix . Setting::TABLE_NAME; $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS {$table_name} (\n\t\t\t\tid BIGINT(20) NOT NULL AUTO_INCREMENT,\n\t\t\t\tpost_id BIGINT(20) UNSIGNED NOT NULL,\n\t\t\t\tpost_title TEXT NOT NULL,\n\t\t\t\tfacebook BIGINT(20) UNSIGNED NOT NULL,\n\t\t\t\ttwitter BIGINT(20) UNSIGNED NOT NULL,\n\t\t\t\tgoogle BIGINT(20) UNSIGNED NOT NULL,\n\t\t\t\tlinkedin BIGINT(20) UNSIGNED NOT NULL,\n\t\t\t\tpinterest BIGINT(20) UNSIGNED NOT NULL,\n\t\t\t\ttotal BIGINT(20) UNSIGNED NOT NULL,\n\t\t\t\tPRIMARY KEY id ( id ),\n\t\t\t\tUNIQUE( post_id )\n\t\t\t) {$charset};"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta($sql); Utils_Helper::add_update_option(Setting::TABLE_NAME . '_db_version'); }