Changeset 37574
- Timestamp:
- 05/26/2016 04:58:13 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/upgrade.php
r37538 r37574 2201 2201 case 'unique': 2202 2202 case 'key': 2203 case 'spatial': 2203 2204 $validfield = false; 2204 2205 $indices[] = trim(trim($fld), ", \n"); … … 2301 2302 if ( 'FULLTEXT' === strtoupper( $index_data['index_type'] ) ) { 2302 2303 $index_string .= 'FULLTEXT '; 2304 } 2305 if ( 'SPATIAL' === strtoupper( $index_data['index_type'] ) ) { 2306 $index_string .= 'SPATIAL '; 2303 2307 } 2304 2308 $index_string .= 'KEY '; -
trunk/tests/phpunit/tests/dbdelta.php
r37538 r37574 489 489 $this->assertEmpty( $updates ); 490 490 } 491 492 /** 493 * @ticket 36948 494 */ 495 function test_spatial_indices() { 496 global $wpdb; 497 498 if ( version_compare( $wpdb->db_version(), '5.4', '<' ) ) { 499 $this->markTestSkipped( 'Spatial indices require MySQL 5.4 and above.' ); 500 } 501 502 $schema = 503 " 504 CREATE TABLE {$wpdb->prefix}spatial_index_test ( 505 non_spatial bigint(20) unsigned NOT NULL, 506 spatial_value geometrycollection NOT NULL, 507 KEY non_spatial (non_spatial), 508 SPATIAL KEY spatial_key (spatial_value) 509 ) ENGINE=MyISAM; 510 "; 511 512 $wpdb->query( $schema ); 513 514 $updates = dbDelta( $schema, false ); 515 516 $this->assertEmpty( $updates ); 517 518 $schema = 519 " 520 CREATE TABLE {$wpdb->prefix}spatial_index_test ( 521 non_spatial bigint(20) unsigned NOT NULL, 522 spatial_value geometrycollection NOT NULL, 523 spatial_value2 geometrycollection NOT NULL, 524 KEY non_spatial (non_spatial), 525 SPATIAL KEY spatial_key (spatial_value) 526 SPATIAL KEY spatial_key2 (spatial_value2) 527 ) ENGINE=MyISAM; 528 "; 529 530 $updates = dbDelta( $schema, false ); 531 532 $this->assertSame( array( 533 "{$wpdb->prefix}spatial_index_test.spatial_value2" => "Added column {$wpdb->prefix}spatial_index_test.spatial_value2", 534 "Added index {$wpdb->prefix}spatial_index_test SPATIAL KEY spatial_key2 (spatial_value2)" 535 ), $updates ); 536 537 $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}spatial_index_test" ); 538 } 491 539 }
Note: See TracChangeset
for help on using the changeset viewer.