get_charset_collate(); $tableName = PageRepository::tableName(); // page_value is longtext: a page with many fields is more than the 64 KB of text. schema_version is the // format of page_value (0: PHP serialize of versions before 1.0, 1: JSON, see PageRepository). // `plugin` stays until Pro has its own way to recognize its rows. $sql = "CREATE TABLE $tableName ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, time datetime NOT NULL, menu_slug varchar(191) NOT NULL, page_value longtext NOT NULL, plugin text NOT NULL, schema_version smallint(5) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (id), KEY menu_slug (menu_slug) ) $charsetCollate;"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; \dbDelta($sql); } public static function dropPluginTable() { require_once ABSPATH . 'wp-admin/includes/upgrade.php'; $sql = sprintf('DROP TABLE IF EXISTS %s', PageRepository::tableName()); static::wpdb()->query($sql); } }