ostark / upper

Integrates Edge Caches like Fastly, KeyCDN, Cloudflare and Varnish with Craft.
MIT License
102 stars 22 forks source link

SQLSTATE[HY000]: General error: 1221 Incorrect usage of spatial/fulltext/hash index and explicit index order #44

Closed myleshyson closed 3 years ago

myleshyson commented 3 years ago

Getting this error whenever I try to install the plugin via php craft plugin/install upper.

./Docker/bin/craft plugin/install upper
*** installing upper
    > create table {{%upper_cache}} ... done (time: 0.015s)
  > Create index: urlhash_idx
    > create unique index urlhash_idx on {{%upper_cache}} (urlHash) ... done (time: 0.014s)
    > execute SQL: ALTER TABLE {{%upper_cache}} ADD FULLTEXT INDEX tags_fulltext (tags ASC) ...Exception: SQLSTATE[HY000]: General error: 1221 Incorrect usage of spatial/fulltext/hash index and explicit index order
The SQL being executed was: ALTER TABLE `upper_cache` ADD FULLTEXT INDEX tags_fulltext (tags ASC) (/var/www/html/vendor/yiisoft/yii2/db/Schema.php:678)
#0 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1304): yii\db\Schema->convertException(Object(PDOException), 'ALTER TABLE `up...')
#1 /var/www/html/vendor/yiisoft/yii2/db/Command.php(1099): yii\db\Command->internalExecute('ALTER TABLE `up...')
#2 /var/www/html/vendor/yiisoft/yii2/db/Migration.php(219): yii\db\Command->execute()
#3 /var/www/html/vendor/ostark/upper/src/migrations/Install.php(35): yii\db\Migration->execute('ALTER TABLE {{%...')
#4 /var/www/html/vendor/craftcms/cms/src/db/Migration.php(52): ostark\upper\migrations\Install->safeUp()
#5 /var/www/html/vendor/craftcms/cms/src/db/MigrationManager.php(232): craft\db\Migration->up(true)
#6 /var/www/html/vendor/craftcms/cms/src/base/Plugin.php(140): craft\db\MigrationManager->migrateUp(Object(ostark\upper\migrations\Install))
#7 /var/www/html/vendor/craftcms/cms/src/services/Plugins.php(527): craft\base\Plugin->install()
#8 /var/www/html/vendor/craftcms/cms/src/console/controllers/PluginController.php(44): craft\services\Plugins->installPlugin('upper')
#9 [internal function]: craft\console\controllers\PluginController->actionInstall('upper')
#10 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(181): yii\base\InlineAction->runWithParams(Array)
#12 /var/www/html/vendor/yiisoft/yii2/console/Controller.php(184): yii\base\Controller->runAction('install', Array)
#13 /var/www/html/vendor/craftcms/cms/src/console/Controller.php(193): yii\console\Controller->runAction('install', Array)
#14 /var/www/html/vendor/yiisoft/yii2/base/Module.php(534): craft\console\Controller->runAction('install', Array)
#15 /var/www/html/vendor/yiisoft/yii2/console/Application.php(181): yii\base\Module->runAction('plugin/install', Array)
#16 /var/www/html/vendor/craftcms/cms/src/console/Application.php(89): yii\console\Application->runAction('plugin/install', Array)
#17 /var/www/html/vendor/yiisoft/yii2/console/Application.php(148): craft\console\Application->runAction('plugin/install', Array)
#18 /var/www/html/vendor/yiisoft/yii2/base/Application.php(392): yii\console\Application->handleRequest(Object(craft\console\Request))
#19 /var/www/html/craft(23): yii\base\Application->run()
#20 {main}
*** installed upper successfully (time: 0.104s)

I'm running: mysql: 8.0.23 php: 8.0.1 craft: 3.6.2

ostark commented 3 years ago

@myleshyson thanks for your report. I need to test this against MySQL 8.

myleshyson commented 3 years ago

I think the issue here is this line. Was reading the Mysql 8 docs and according to this (it's the very last line on the page) explicitly specifying ASC or DESC on a FULLTEXT, HASH, and SPATIAL indexes will result in an error.

ostark commented 3 years ago

That's what I assumed. Will fix it.

ostark commented 3 years ago

https://github.com/ostark/upper/releases/tag/1.8.0