ryssbowh/craft-emails

SQL error when trying to install pllugin

Closed this issue · 2 comments

Describe the bug

/app $ php craft plugin/install emails
*** installing emails
    > create table {{%emails}} ...Exception: SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB, TEXT, GEOMETRY or JSON column 'instructions' can't have a default value
The SQL being executed was: CREATE TABLE `emails` (
	`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	`key` varchar(255) NOT NULL,
	`template` varchar(255),
	`system` tinyint(1) DEFAULT FALSE,
	`redactorConfig` varchar(255),
	`heading` varchar(255) NOT NULL,
	`instructions` text DEFAULT '',
	`from` varchar(255),
	`fromName` varchar(255),
	`replyTo` varchar(255),
	`bcc` varchar(255),
	`cc` varchar(255),
	`plain` tinyint(1) DEFAULT FALSE,
	`saveLogs` tinyint(1),
	`sent` int(11) DEFAULT 0,
	`dateCreated` datetime(0) NOT NULL,
	`dateUpdated` datetime(0) NOT NULL,
	`uid` char(36) NOT NULL DEFAULT '0'
) ENGINE = InnoDb DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE = utf8_unicode_ci (/app/vendor/yiisoft/yii2/db/Schema.php:676)
#0 /app/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'CREATE TABLE `e...')
#1 /app/vendor/yiisoft/yii2/db/Command.php(1102): yii\db\Command->internalExecute('CREATE TABLE `e...')
#2 /app/vendor/yiisoft/yii2/db/Migration.php(323): yii\db\Command->execute()
#3 /app/vendor/ryssbowh/craft-emails/src/migrations/Install.php(36): yii\db\Migration->createTable('{{%emails}}', Array)
#4 /app/vendor/craftcms/cms/src/db/Migration.php(49): Ryssbowh\CraftEmails\migrations\Install->safeUp()
#5 /app/vendor/craftcms/cms/src/db/MigrationManager.php(233): craft\db\Migration->up(true)
#6 /app/vendor/craftcms/cms/src/base/Plugin.php(136): craft\db\MigrationManager->migrateUp(Object(Ryssbowh\CraftEmails\migrations\Install))
#7 /app/vendor/craftcms/cms/src/services/Plugins.php(531): craft\base\Plugin->install()
#8 /app/vendor/craftcms/cms/src/console/controllers/PluginController.php(129): craft\services\Plugins->installPlugin('emails')
#9 [internal function]: craft\console\controllers\PluginController->actionInstall('emails')
#10 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#11 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#12 /app/vendor/yiisoft/yii2/console/Controller.php(182): yii\base\Controller->runAction('install', Array)
#13 /app/vendor/craftcms/cms/src/console/Controller.php(223): yii\console\Controller->runAction('install', Array)
#14 /app/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('install', Array)
#15 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('plugin/install', Array)
#16 /app/vendor/craftcms/cms/src/console/Application.php(93): yii\console\Application->runAction('plugin/install', Array)
#17 /app/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('plugin/install', Array)
#18 /app/vendor/yiisoft/yii2/base/Application.php(384): yii\console\Application->handleRequest(Object(craft\console\Request))
#19 /app/craft(13): yii\base\Application->run()
#20 {main}
*** failed to install emails: An error occurred while executing the "Ryssbowh\CraftEmails\migrations\Install migration: SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB, TEXT, GEOMETRY or JSON column 'instructions' can't have a default value
The SQL being executed was: CREATE TABLE `emails` (
	`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
	`key` varchar(255) NOT NULL,
	`template` varchar(255),
	`system` tinyint(1) DEFAULT FALSE,
	`redactorConfig` varchar(255),
	`heading` varchar(255) NOT NULL,
	`instructions` text DEFAULT '',
	`from` varchar(255),
	`fromName` varchar(255),
	`replyTo` varchar(255),
	`bcc` varchar(255),
	`cc` varchar(255),
	`plain` tinyint(1) DEFAULT FALSE,
	`saveLogs` tinyint(1),
	`sent` int(11) DEFAULT 0,
	`dateCreated` datetime(0) NOT NULL,
	`dateUpdated` datetime(0) NOT NULL,
	`uid` char(36) NOT NULL DEFAULT '0'
) ENGINE = InnoDb DEFAULT CHARACTER SET = utf8 DEFAULT COLLATE = utf8_unicode_ci

To Reproduce
Steps to reproduce the behavior:

  1. CLI Install via composer
  2. CLI craft plugin/install emails

Software:

  • Emails version: 2.0.0-beta.1
  • Craft version: 4.0.0-beta.3
  • Email adaptor (sendgrid etc):
  • MySQL version: 8.0.28
  • PHP version: 8.1.3

Thanks for reporting, that should be fixed in 2.0.0-beta.2

And thanks for fixing! I updated and got it installed this time, no problem.