get_charset_collate(); $table = $wpdb->prefix . '100p_generation_history'; $sql = "CREATE TABLE $table ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, generation_uuid varchar(36) NOT NULL, template_id varchar(255) NOT NULL, template_name varchar(255) NOT NULL DEFAULT '', user_id bigint(20) unsigned NULL, visitor_ip varchar(45) NULL, variables_json longtext NULL, output_format varchar(10) NOT NULL DEFAULT 'pdf', render_quality varchar(20) NOT NULL DEFAULT 'high', status varchar(20) NOT NULL DEFAULT 'success', page_id bigint(20) unsigned NULL DEFAULT 0, created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id), UNIQUE KEY idx_uuid (generation_uuid), KEY idx_template_id (template_id), KEY idx_status (status), KEY idx_created (created_at) ) $charset_collate;\n"; require_once ABSPATH . 'wp-admin/includes/upgrade.php'; dbDelta( $sql ); } /** * Set default options for settings. */ private static function set_default_settings() { if ( ! get_option( '100p_settings' ) ) { update_option( '100p_settings', hundred_prints_default_settings() ); } } }