Commit 9f7c75f2 authored by Jan Sorgalla's avatar Jan Sorgalla

Allow mysql spatial indexes

parent c61361d8
...@@ -718,6 +718,8 @@ class MySqlPlatform extends AbstractPlatform ...@@ -718,6 +718,8 @@ class MySqlPlatform extends AbstractPlatform
$type .= 'UNIQUE '; $type .= 'UNIQUE ';
} elseif ($index->hasFlag('fulltext')) { } elseif ($index->hasFlag('fulltext')) {
$type .= 'FULLTEXT '; $type .= 'FULLTEXT ';
} elseif ($index->hasFlag('spatial')) {
$type .= 'SPATIAL ';
} }
return $type; return $type;
......
...@@ -268,6 +268,20 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase ...@@ -268,6 +268,20 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
$this->assertEquals(array('CREATE TABLE fulltext_table (text LONGTEXT NOT NULL, FULLTEXT INDEX fulltext_text (text)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $sql); $this->assertEquals(array('CREATE TABLE fulltext_table (text LONGTEXT NOT NULL, FULLTEXT INDEX fulltext_text (text)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $sql);
} }
public function testCreateTableWithSpatialIndex()
{
$table = new Table('spatial_table');
$table->addOption('engine', 'MyISAM');
$table->addColumn('point', 'text'); // This should be a point type
$table->addIndex(array('point'), 'spatial_text');
$index = $table->getIndex('spatial_text');
$index->addFlag('spatial');
$sql = $this->_platform->getCreateTableSQL($table);
$this->assertEquals(array('CREATE TABLE spatial_table (point LONGTEXT NOT NULL, SPATIAL INDEX spatial_text (point)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = MyISAM'), $sql);
}
public function testClobTypeDeclarationSQL() public function testClobTypeDeclarationSQL()
{ {
$this->assertEquals('TINYTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 1))); $this->assertEquals('TINYTEXT', $this->_platform->getClobTypeDeclarationSQL(array('length' => 1)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment