1

Running a migration from the command line ./craft migrate/all I get the following error message:

Exception 'craft\errors\MigrateException' with message 'An error occurred while migrating Sprout Forms.'

Here is the log:

2020-02-28 14:02:48 [-][-][-][error][craft\db\MigrationManager::migrateUp] Failed to apply m190318_000001_update_record_to_element_types_sproutforms (time: 0.464s).
2020-02-28 14:02:48 [-][-][-][error][craft\db\MigrationManager::up] Migration failed. The rest of the migrations are cancelled.
2020-02-28 14:02:48 [-][-][-][trace][yii\db\Transaction::rollBack] Roll back transaction
2020-02-28 14:02:48 [-][-][-][error][craft\errors\MigrateException] yii\base\UnknownPropertyException: Setting unknown property: barrelstrength\sproutbasereports\records\Report::emailColumn in /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Component.php:209
Stack trace:
#0 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/db/BaseActiveRecord.php(324): yii\base\Component->__set('emailColumn', NULL)
#1 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/db/ActiveRecord.php(41): yii\db\BaseActiveRecord->__set('emailColumn', NULL)
#2 /Users/adammenczykowski/code/Fira/fira/vendor/barrelstrength/sprout-base-reports/src/elements/Report.php(492): craft\db\ActiveRecord->__set('emailColumn', NULL)
#3 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/services/Elements.php(2123): barrelstrength\sproutbasereports\elements\Report->afterSave(true)
#4 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/services/Elements.php(530): craft\services\Elements->_saveElementInternal(Object(barrelstrength\sproutbasereports\elements\Report), false, false, true)
#5 /Users/adammenczykowski/code/Fira/fira/vendor/barrelstrength/sprout-base-reports/src/migrations/m190305_000002_update_record_to_element_types.php(60): craft\services\Elements->saveElement(Object(barrelstrength\sproutbasereports\elements\Report), false)
#6 /Users/adammenczykowski/code/Fira/fira/vendor/barrelstrength/sprout-forms/src/migrations/m190318_000001_update_record_to_element_types_sproutforms.php(29): barrelstrength\sproutbasereports\migrations\m190305_000002_update_record_to_element_types->safeUp()
#7 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/db/Migration.php(52): barrelstrength\sproutforms\migrations\m190318_000001_update_record_to_element_types_sproutforms->safeUp()
#8 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/db/MigrationManager.php(233): craft\db\Migration->up(true)
#9 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/db/MigrationManager.php(153): craft\db\MigrationManager->migrateUp(Object(barrelstrength\sproutforms\migrations\m190318_000001_update_record_to_element_types_sproutforms))
#10 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/services/Updates.php(233): craft\db\MigrationManager->up()
#11 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/console/controllers/MigrateController.php(259): craft\services\Updates->runMigrations(Array)
#12 [internal function]: craft\console\controllers\MigrateController->actionAll()
#13 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#14 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#15 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('all', Array)
#16 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('all', Array)
#17 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
#18 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/console/Application.php(87): yii\console\Application->runAction('migrate/all', Array)
#19 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('migrate/all', Array)
#20 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#21 /Users/adammenczykowski/code/Fira/fira/craft(22): yii\base\Application->run()
#22 {main}

Next craft\errors\MigrationException: An error occurred while executing the "barrelstrength\sproutforms\migrations\m190318_000001_update_record_to_element_types_sproutforms migration: Setting unknown property: barrelstrength\sproutbasereports\records\Report::emailColumn in /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/db/MigrationManager.php:250
Stack trace:
#0 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/db/MigrationManager.php(153): craft\db\MigrationManager->migrateUp(Object(barrelstrength\sproutforms\migrations\m190318_000001_update_record_to_element_types_sproutforms))
#1 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/services/Updates.php(233): craft\db\MigrationManager->up()
#2 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/console/controllers/MigrateController.php(259): craft\services\Updates->runMigrations(Array)
#3 [internal function]: craft\console\controllers\MigrateController->actionAll()
#4 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#5 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#6 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('all', Array)
#7 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('all', Array)
#8 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
#9 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/console/Application.php(87): yii\console\Application->runAction('migrate/all', Array)
#10 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('migrate/all', Array)
#11 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#12 /Users/adammenczykowski/code/Fira/fira/craft(22): yii\base\Application->run()
#13 {main}

Next craft\errors\MigrateException: An error occurred while migrating Sprout Forms. in /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/services/Updates.php:241
Stack trace:
#0 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/console/controllers/MigrateController.php(259): craft\services\Updates->runMigrations(Array)
#1 [internal function]: craft\console\controllers\MigrateController->actionAll()
#2 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#3 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#4 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('all', Array)
#5 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('all', Array)
#6 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('migrate/all', Array)
#7 /Users/adammenczykowski/code/Fira/fira/vendor/craftcms/cms/src/console/Application.php(87): yii\console\Application->runAction('migrate/all', Array)
#8 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('migrate/all', Array)
#9 /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(craft\console\Request))
#10 /Users/adammenczykowski/code/Fira/fira/craft(22): yii\base\Application->run()
#11 {main}
2020-02-28 14:02:47 [-][-][-][info][application] $_GET = []

Specifically [craft\errors\MigrateException] yii\base\UnknownPropertyException: Setting unknown property: barrelstrength\sproutbasereports\records\Report::emailColumn in /Users/adammenczykowski/code/Fira/fira/vendor/yiisoft/yii2/base/Component.php:209

Running Craft 3.4.8 and Sprout Forms 3.8.5 The migration is being applied to a DB that comes from a Craft v2 install using Sprout Forms 2.6.4 on Craft 2.7.10.

Any help would be appreciated @ben-parizek

7
  • The short answer is that the migration that is failing is using the Element API and the Report Element model has new attributes that probably don't exist in the data structure at the right time in the migration. I think the solution will be to update to a different version of Sprout Forms as a middle step before upgrading to the latest. My initial guess is that will be v3.7.1.1 but that may come with some caveats as well that I'll need to explore before saying more. Feb 28 '20 at 15:08
  • Thanks Ben, I'll give that a shot! Feb 28 '20 at 15:50
  • Hmm didn't work - exact same migration fails. should I perhaps try out an older version. should I lower the version of another package like you mentioned element api? @BenParizek Feb 28 '20 at 16:56
  • I've just tagged a new release that I believe will be the best to target to get around this. Please try targeting Sprout Forms v3.7.2. That should pull in all the appropriate dependencies (whereas there was a composer dependency bug in v3.7.1.1 that could pull in Craft 3.4 dependencies still). Getting updated to v3.7.2 should make sure that Report Model has the correct attributes on it during the v2 => v3 upgrade. Feb 28 '20 at 16:58
  • Thanks Ben, will try now. I have fields, email, lists and reports as dependencies also fyi Feb 28 '20 at 17:02
2

Due to some underlying changes in the Sprout application architecture, and the fact you're migrating a database from Craft 2, I believe you will need to upgrade to Craft 3.3 and related Sprout plugins compatible with Craft 3.3 before you update to Craft 3.4.

Below is a list of the Craft 3.3 compatible versions of several of the Sprout plugins.

barrelstrength/sprout-forms:v3.7.2
barrelstrength/sprout-email:v4.0.8
barrelstrength/sprout-reports:v1.2.12
barrelstrength/sprout-fields:v3.5.5
barrelstrength/sprout-seo:v4.2.12
barrelstrength/sprout-sitemaps:v1.0.5
barrelstrength/sprout-redirects:v1.2.5
barrelstrength/sprout-lists:v2.0.1
2
  • Thanks Ben, will give this a go. Much appreciated. Feb 28 '20 at 21:37
  • I can confirm that worked, thank you. Mar 6 '20 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.