PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 2.11.0
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v2.11.0
2.11.0 2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 All 78 releases
← All changes | database/Migrations/FeedReactionsMigrator.php +32 -3 1.0.962.11.0 View file →
@@ -25,12 +25,41 @@
25 25 `type` VARCHAR(100) NULL DEFAULT 'like',
26 26 `ip_address` VARCHAR(100) NULL,
27 27 `created_at` TIMESTAMP NULL,
28 28 `updated_at` TIMESTAMP NULL,
29 - INDEX `object_id` (`object_id`),
30 - INDEX `object_type` (`object_type`),
31 - INDEX `type` (`type`)
29 + INDEX object_user_object_type_type (object_id, user_id, object_type, type),
30 + INDEX object_type_parent_id_user_id (object_type, parent_id, user_id)
32 31 ) $charsetCollate;";
33 32 dbDelta($sql);
33 + } else {
34 + $indexes = $wpdb->get_results("SHOW INDEX FROM $table");
35 +
36 + $hasObjectUserObjectTypeType = false;
37 + $hasObjectTypeParentIdUserId = false;
38 +
39 + foreach ($indexes as $index) {
40 + if ($index->Key_name === 'object_user_object_type_type') {
41 + $hasObjectUserObjectTypeType = true;
42 + }
43 + if ($index->Key_name === 'object_type_parent_id_user_id') {
44 + $hasObjectTypeParentIdUserId = true;
45 + }
46 + }
47 +
48 + if (!$hasObjectUserObjectTypeType) {
49 + $wpdb->query("ALTER TABLE $table ADD INDEX object_user_object_type_type (object_id, user_id, object_type, type)");
50 + }
51 +
52 + if (!$hasObjectTypeParentIdUserId) {
53 + $wpdb->query("ALTER TABLE $table ADD INDEX object_type_parent_id_user_id (object_type, parent_id, user_id)");
54 + }
55 +
56 + $removeIndexes = ['object_id', 'object_type', 'type'];
57 +
58 + foreach ($indexes as $index) {
59 + if (in_array($index->Key_name, $removeIndexes)) {
60 + $wpdb->query("ALTER TABLE $table DROP INDEX $index->Key_name");
61 + }
62 + }
34 63 }
35 64 }
36 65 }