Skip to content

Commit d4e27d4

Browse files
committed
Collaboration: Add type_client_id index and bump db_version
Add a composite index on (type, client_id) to the collaboration table to speed up awareness upserts, which filter on both columns. Bump $wp_db_version from 61840 to 61841 so existing installations pick up the schema change via dbDelta on upgrade.
1 parent 7455141 commit d4e27d4

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/wp-admin/includes/schema.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,10 @@ function wp_get_db_schema( $scope = 'all', $blog_id = null ) {
193193
type varchar(32) NOT NULL default '',
194194
client_id varchar(32) NOT NULL default '',
195195
user_id bigint(20) unsigned NOT NULL default '0',
196-
update_value longtext NOT NULL,
196+
data longtext NOT NULL,
197197
date_gmt datetime NOT NULL default '0000-00-00 00:00:00',
198198
PRIMARY KEY (id),
199+
KEY type_client_id (type,client_id),
199200
KEY room (room,id),
200201
KEY date_gmt (date_gmt)
201202
) $charset_collate;\n";

src/wp-admin/includes/upgrade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ function upgrade_all() {
886886
upgrade_682();
887887
}
888888

889-
if ( $wp_current_db_version < 61840 ) {
889+
if ( $wp_current_db_version < 61841 ) {
890890
upgrade_700();
891891
}
892892

src/wp-includes/collaboration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
* Checks whether real-time collaboration is enabled.
1111
*
1212
* The feature requires both the site option and the database schema
13-
* introduced in db_version 61840.
13+
* introduced in db_version 61841.
1414
*
1515
* @since 7.0.0
1616
*
1717
* @return bool True if collaboration is enabled, false otherwise.
1818
*/
1919
function wp_is_collaboration_enabled() {
2020
return get_option( 'wp_enable_real_time_collaboration' )
21-
&& get_option( 'db_version' ) >= 61840;
21+
&& get_option( 'db_version' ) >= 61841;
2222
}
2323

2424
/**

src/wp-includes/version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @global int $wp_db_version
2525
*/
26-
$wp_db_version = 61840;
26+
$wp_db_version = 61841;
2727

2828
/**
2929
* Holds the TinyMCE version.

0 commit comments

Comments
 (0)