Make WordPress Core

Ticket #36948: dbdelta_spatial_index_test_corrected.php

File dbdelta_spatial_index_test_corrected.php, 531 bytes (added by stuporglue, 8 years ago)

The previous test file did not give the spatial index a name which caused it to get re-added each time dbDelta ran.

Line 
1<?php
2
3require_once(__DIR__ . '/wp-load.php');
4require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
5
6// Only MyISAM supports spatial indexes, at least in MySQL older versions
7// Spatial indexes can only contain non-null columns
8$geotables = "CREATE TABLE {$wpdb->prefix}index_test (
9non_spatial bigint(20) unsigned NOT NULL,
10meta_value GEOMETRYCOLLECTION NOT NULL,
11KEY non_spatial (non_spatial),
12SPATIAL KEY meta_value (meta_value)
13) ENGINE=MyISAM;";
14
15print "\n\n" . $geotables . "\n\n";
16
17dbDelta( $geotables );
18
19print "\n";