ostark / upper

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

"Table already exists" error when reinstalling #59

Closed L3P3 closed 2 years ago

L3P3 commented 2 years ago

Having the same issue with MySQL 5.7.35 and Craft 3.7.30.1. Always have to delete the table by hand to install it.

> create table {{%upper_cache}} ...Exception: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'pcms_upper_cache' already exists
The SQL being executed was: CREATE TABLE `pcms_upper_cache` (
    `uid` varchar(40) NOT NULL UNIQUE,
    `url` text NOT NULL,
    `urlHash` varchar(32) NOT NULL,
    `headers` text NULL DEFAULT NULL,
    `tags` text NOT NULL,
    `siteId` int(11),
    `dateCreated` datetime(0) NOT NULL,
    `dateUpdated` datetime(0) NULL DEFAULT NULL
) ENGINE = InnoDb DEFAULT CHARACTER SET = utf8 (/src/cms/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /src/cms/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'CREATE TABLE `p...')
#1 /src/cms/vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute('CREATE TABLE `p...')
#2 /src/cms/vendor/yiisoft/yii2/db/Migration.php(323): yii\db\Command->execute()
#3 /src/cms/vendor/ostark/upper/src/migrations/Install.php(29): yii\db\Migration->createTable('{{%upper_cache}...', Array)
#4 /src/cms/vendor/craftcms/cms/src/db/Migration.php(52): ostark\upper\migrations\Install->safeUp()
#5 /src/cms/vendor/craftcms/cms/src/db/MigrationManager.php(232): craft\db\Migration->up(true)
#6 /src/cms/vendor/craftcms/cms/src/base/Plugin.php(140): craft\db\MigrationManager->migrateUp(Object(ostark\upper\migrations\Install))
#7 /src/cms/vendor/craftcms/cms/src/services/Plugins.php(535): craft\base\Plugin->install()
#8 /src/cms/vendor/craftcms/cms/src/console/controllers/PluginController.php(80): craft\services\Plugins->installPlugin('upper')
#9 [internal function]: craft\console\controllers\PluginController->actionInstall('upper')
#10 /src/cms/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /src/cms/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#12 /src/cms/vendor/yiisoft/yii2/console/Controller.php(182): yii\base\Controller->runAction('install', Array)
#13 /src/cms/vendor/craftcms/cms/src/console/Controller.php(221): yii\console\Controller->runAction('install', Array)
#14 /src/cms/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('install', Array)
#15 /src/cms/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('plugin/install', Array)
#16 /src/cms/vendor/craftcms/cms/src/console/Application.php(89): yii\console\Application->runAction('plugin/install', Array)
#17 /src/cms/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('plugin/install', Array)
#18 /src/cms/vendor/yiisoft/yii2/base/Application.php(384): yii\console\Application->handleRequest(Object(craft\console\Request))
#19 /src/cms/craft(22): yii\base\Application->run()
#20 {main}

Originally posted by @elfacht in https://github.com/ostark/upper/issues/55#issuecomment-1026778925

ostark commented 2 years ago

Thanks! I'll have a look.

L3P3 commented 2 years ago

Thanks for quick reaction, hope for a release in near future so we don't have to rely on dev branch. :wink:

ostark commented 2 years ago

Thanks for the PR! However develop is completely not in sync with master. I'll do a proper release later today.