PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | database/Migrations/Migrator.php +19 -2 1.3.21 → 1.6.5 View file →
@@ -117,9 +117,10 @@
117 117 {
118 118 $wpdb = Schema::db();
119 119 $tableName = static::getTableName();
120 120
121 - // SHOW INDEX is translated by the WP SQLite integration plugin
121 + // SHOW INDEX works on both MySQL and SQLite (the WP SQLite integration
122 + // plugin translates it).
122 123 // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching
123 124 $results = $wpdb->get_results($wpdb->prepare(
124 125 "SHOW INDEX FROM %i WHERE Key_name = %s",
125 126 $tableName,
@@ -168,9 +169,25 @@
168 169 if (!static::hasIndex($indexName)) {
169 170 return;
170 171 }
171 172
172 - Schema::dropIndex(static::$tableName, $indexName);
173 + // Drop the index with a single direct ALTER rather than routing through
174 + // Schema::dropIndex(), which calls WP core drop_index(). That core helper
175 + // fires 25 speculative "DROP INDEX {name}_0".."_24" queries to clean up
176 + // stray dbDelta-created duplicates; none of those variants exist for our
177 + // explicitly-named indexes, so each one errors as "Can't DROP ..., check
178 + // that column/key exists" and floods migration/test output with noise.
179 + // hasIndex() above already confirmed the real index is present, so one
180 + // ALTER is sufficient. The %i placeholder mirrors hasIndex() and keeps
181 + // this safe on both MySQL and the WP SQLite integration.
182 + $wpdb = Schema::db();
183 + $tableName = static::getTableName();
184 + // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared
185 + $wpdb->query($wpdb->prepare(
186 + "ALTER TABLE %i DROP INDEX %i",
187 + $tableName,
188 + $indexName
189 + ));
173 190 }
174 191
175 192 public static function getTableName(bool $withPrefix = true): string
176 193 {