Add spatial indexes

This commit is contained in:
2025-04-20 22:24:58 -07:00
parent 65b1b6365e
commit 1dac9cc3df
4 changed files with 66 additions and 4 deletions

View File

@@ -43,14 +43,14 @@ class PMA_Index
protected $_columns = array();
/**
* The index method used (BTREE, FULLTEXT, HASH, RTREE).
* The index method used (BTREE, SPATIAL, FULLTEXT, HASH, RTREE).
*
* @var string
*/
protected $_type = '';
/**
* The index choice (PRIMARY, UNIQUE, INDEX, FULLTEXT)
* The index choice (PRIMARY, UNIQUE, INDEX, SPATIAL, FULLTEXT)
*
* @var string
*/
@@ -269,6 +269,8 @@ class PMA_Index
$this->_choice = 'PRIMARY';
} elseif ('FULLTEXT' == $this->_type) {
$this->_choice = 'FULLTEXT';
} elseif ('SPATIAL' == $this->_type) {
$this->_choice = 'SPATIAL';
} elseif ('0' == $this->_non_unique) {
$this->_choice = 'UNIQUE';
} else {
@@ -323,6 +325,7 @@ class PMA_Index
'PRIMARY',
'INDEX',
'UNIQUE',
'SPATIAL',
'FULLTEXT',
);
}

View File

@@ -88,6 +88,11 @@ if (! empty($submit_mult)
$query_type = 'unique_fld';
$mult_btn = __('Yes');
break;
case 'spatial':
unset($submit_mult);
$query_type = 'spatial_fld';
$mult_btn = __('Yes');
break;
case 'ftext':
unset($submit_mult);
$query_type = 'fulltext_fld';
@@ -368,6 +373,12 @@ elseif ($mult_btn == __('Yes')) {
. (($i == $selected_cnt-1) ? ');' : '');
break;
case 'spatial_fld':
$sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ' ADD SPATIAL( ' : ', ')
. PMA_backquote($selected[$i])
. (($i == $selected_cnt-1) ? ');' : '');
break;
case 'fulltext_fld':
$sql_query .= (empty($sql_query) ? 'ALTER TABLE ' . PMA_backquote($table) . ' ADD FULLTEXT( ' : ', ')
. PMA_backquote($selected[$i])