| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | require_once(__DIR__ . '/wp-load.php');
|
|---|
| 4 | require_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 (
|
|---|
| 9 | non_spatial bigint(20) unsigned NOT NULL,
|
|---|
| 10 | meta_value GEOMETRYCOLLECTION NOT NULL,
|
|---|
| 11 | KEY non_spatial (non_spatial),
|
|---|
| 12 | SPATIAL KEY (meta_value)
|
|---|
| 13 | ) ENGINE=MyISAM;";
|
|---|
| 14 |
|
|---|
| 15 | print "\n\n" . $geotables . "\n\n";
|
|---|
| 16 |
|
|---|
| 17 | dbDelta( $geotables );
|
|---|
| 18 |
|
|---|
| 19 | print "\n";
|
|---|