spotorm / spot2

Spot v2.x DataMapper built on top of Doctrine's Database Abstraction Layer
http://phpdatamapper.com
BSD 3-Clause "New" or "Revised" License
601 stars 101 forks source link

Fulltext Index Support #205

Closed SomewhatCloudy closed 4 years ago

SomewhatCloudy commented 7 years ago

Added support for Fulltext Indexes in the Migrator. Since MySQL 5.6 InnoDB now supports them.

SomewhatCloudy commented 7 years ago

So it seems to be failing on the table test_events_search, with the following:

'CREATE TABLEtest_events_search(event_idINT UNSIGNED NOT NULL,idINT UNSIGNED AUTO_INCREMENT NOT NULL,bodyLONGTEXT NOT NULL, INDEXtest_events_search_event_id(event_id), FULLTEXT INDEXtest_events_search_body(body), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci **ENGINE = InnoDB'**

But in the test entity itself, it specifies:

// MyISAM table for FULLTEXT searching
protected static $tableOptions = [
    **'engine' => 'MyISAM'**
];

Which seems to be being ignored. Unless I am missing something this is the actual issue, which my edit is bringing to light. Maybe a further test needs to be made to check if the table created is MyISAM or InnoDB?

vlucas commented 7 years ago

The current code assumes that "fulltext" searching is MyISAM only (which it was). Looks like it needs to be updated to support newer MySQL versions. We probably need to ensure that "fulltext" can only be set with "MyISAM" as the engine when MySQL is under a certain version, but that would require an additional check.

Either that, or we just assume the user knows what they are doing, and try to run the operations no matter the "engine" specified?