WordPress.org

Make WordPress Core

Ticket #36948: dbdelta_spatial_index_test.php

File dbdelta_spatial_index_test.php, 520 bytes (added by stuporglue, 19 months ago)

Test file

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)
13) ENGINE=MyISAM;";
14
15print "\n\n" . $geotables . "\n\n";
16
17dbDelta( $geotables );
18
19print "\n";