craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.28k stars 635 forks source link

Setting unknown property: craft\models\Info::schemaversion #5691

Closed ryanpcmcquen closed 4 years ago

ryanpcmcquen commented 4 years ago

Description

We are attempting to migrate to PostgreSQL and used pgloader to migrate our current MySQL data. When Craft attempts to start we get the following error:

An Error occurred while handling another error:
yii\base\UnknownPropertyException: Setting unknown property: craft\models\Info::schemaversion in /var/www/html/vendor/yiisoft/yii2/base/Component.php:209
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set('schemaversion', '3.3.3')
#1 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\models\Info), Array)
#2 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(630): yii\base\BaseObject->__construct(Array)
#3 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(276): craft\web\Application->getInfo(true)
#4 /var/www/html/vendor/craftcms/cms/src/services/Sites.php(1150): craft\web\Application->getIsInstalled()
#5 /var/www/html/vendor/craftcms/cms/src/services/Sites.php(457): craft\services\Sites->_loadAllSites()
#6 /var/www/html/vendor/yiisoft/yii2/base/Component.php(180): craft\services\Sites->setCurrentSite(NULL)
#7 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set('currentSite', NULL)
#8 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\services\Sites), Array)
#9 [internal function]: yii\base\BaseObject->__construct(Array)
#10 /var/www/html/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array)
#11 /var/www/html/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('craft\\services\\...', Array, Array)
#12 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\services\\...', Array, Array)
#13 /var/www/html/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Array)
#14 /var/www/html/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('sites', true)
#15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->get('sites', true)
#16 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(1211): craft\web\Application->get('sites')
#17 /var/www/html/vendor/craftcms/cms/src/web/Request.php(188): craft\web\Application->getSites()
#18 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Request->init()
#19 [internal function]: yii\base\BaseObject->__construct(Array)
#20 /var/www/html/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array)
#21 /var/www/html/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('craft\\web\\Reque...', Array, Array)
#22 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\web\\Reque...', Array, Array)
#23 /var/www/html/vendor/craftcms/cms/src/config/app.web.php(13): yii\BaseYii::createObject(Array)
#24 [internal function]: {closure}()
#25 /var/www/html/vendor/yiisoft/yii2/di/Container.php(524): call_user_func_array(Object(Closure), Array)
#26 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->invoke(Object(Closure), Array)
#27 /var/www/html/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))
#28 /var/www/html/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('request', true)
#29 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->get('request', true)
#30 /var/www/html/vendor/yiisoft/yii2/web/Application.php(160): craft\web\Application->get('request')
#31 /var/www/html/vendor/craftcms/cms/src/helpers/App.php(683): yii\web\Application->getRequest()
#32 /var/www/html/vendor/craftcms/cms/src/config/app.web.php(18): craft\helpers\App::webResponseConfig()
#33 [internal function]: {closure}()
#34 /var/www/html/vendor/yiisoft/yii2/di/Container.php(524): call_user_func_array(Object(Closure), Array)
#35 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->invoke(Object(Closure), Array)
#36 /var/www/html/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))
#37 /var/www/html/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('response', true)
#38 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->get('response', true)
#39 /var/www/html/vendor/yiisoft/yii2/web/Application.php(169): craft\web\Application->get('response')
#40 /var/www/html/vendor/yiisoft/yii2/web/ErrorHandler.php(92): yii\web\Application->getResponse()
#41 /var/www/html/vendor/craftcms/cms/src/web/ErrorHandler.php(137): yii\web\ErrorHandler->renderException(Object(yii\base\UnknownPropertyException))
#42 /var/www/html/vendor/yiisoft/yii2/base/ErrorHandler.php(111): craft\web\ErrorHandler->renderException(Object(yii\base\UnknownPropertyException))
#43 /var/www/html/vendor/craftcms/cms/src/web/ErrorHandler.php(67): yii\base\ErrorHandler->handleException(Object(yii\base\UnknownPropertyException))
#44 [internal function]: craft\web\ErrorHandler->handleException(Object(yii\base\UnknownPropertyException))
#45 {main}
Previous exception:
yii\base\UnknownPropertyException: Setting unknown property: craft\models\Info::schemaversion in /var/www/html/vendor/yiisoft/yii2/base/Component.php:209
Stack trace:
#0 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set('schemaversion', '3.3.3')
#1 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\models\Info), Array)
#2 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(630): yii\base\BaseObject->__construct(Array)
#3 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(276): craft\web\Application->getInfo(true)
#4 /var/www/html/vendor/craftcms/cms/src/services/Sites.php(1150): craft\web\Application->getIsInstalled()
#5 /var/www/html/vendor/craftcms/cms/src/services/Sites.php(457): craft\services\Sites->_loadAllSites()
#6 /var/www/html/vendor/yiisoft/yii2/base/Component.php(180): craft\services\Sites->setCurrentSite(NULL)
#7 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(558): yii\base\Component->__set('currentSite', NULL)
#8 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(107): yii\BaseYii::configure(Object(craft\services\Sites), Array)
#9 [internal function]: yii\base\BaseObject->__construct(Array)
#10 /var/www/html/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array)
#11 /var/www/html/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('craft\\services\\...', Array, Array)
#12 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\services\\...', Array, Array)
#13 /var/www/html/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Array)
#14 /var/www/html/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('sites', true)
#15 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->get('sites', true)
#16 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(1211): craft\web\Application->get('sites')
#17 /var/www/html/vendor/craftcms/cms/src/web/Request.php(188): craft\web\Application->getSites()
#18 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Request->init()
#19 [internal function]: yii\base\BaseObject->__construct(Array)
#20 /var/www/html/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array)
#21 /var/www/html/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('craft\\web\\Reque...', Array, Array)
#22 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\web\\Reque...', Array, Array)
#23 /var/www/html/vendor/craftcms/cms/src/config/app.web.php(13): yii\BaseYii::createObject(Array)
#24 [internal function]: {closure}()
#25 /var/www/html/vendor/yiisoft/yii2/di/Container.php(524): call_user_func_array(Object(Closure), Array)
#26 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->invoke(Object(Closure), Array)
#27 /var/www/html/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))
#28 /var/www/html/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('request', true)
#29 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->get('request', true)
#30 /var/www/html/vendor/yiisoft/yii2/web/Application.php(160): craft\web\Application->get('request')
#31 /var/www/html/vendor/craftcms/cms/src/helpers/App.php(503): yii\web\Application->getRequest()
#32 /var/www/html/vendor/craftcms/cms/src/config/app.php(219): craft\helpers\App::logConfig()
#33 [internal function]: {closure}()
#34 /var/www/html/vendor/yiisoft/yii2/di/Container.php(524): call_user_func_array(Object(Closure), Array)
#35 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->invoke(Object(Closure), Array)
#36 /var/www/html/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure))
#37 /var/www/html/vendor/yiisoft/yii2/base/Module.php(742): yii\di\ServiceLocator->get('log', true)
#38 /var/www/html/vendor/craftcms/cms/src/web/Application.php(349): yii\base\Module->get('log', true)
#39 /var/www/html/vendor/yiisoft/yii2/base/Application.php(508): craft\web\Application->get('log')
#40 /var/www/html/vendor/craftcms/cms/src/base/ApplicationTrait.php(1354): yii\base\Application->getLog()
#41 /var/www/html/vendor/craftcms/cms/src/web/Application.php(109): craft\web\Application->_preInit()
#42 /var/www/html/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\web\Application->init()
#43 /var/www/html/vendor/yiisoft/yii2/base/Application.php(206): yii\base\BaseObject->__construct(Array)
#44 /var/www/html/vendor/craftcms/cms/src/web/Application.php(100): yii\base\Application->__construct(Array)
#45 [internal function]: craft\web\Application->__construct(Array)
#46 /var/www/html/vendor/yiisoft/yii2/di/Container.php(400): ReflectionClass->newInstanceArgs(Array)
#47 /var/www/html/vendor/yiisoft/yii2/di/Container.php(159): yii\di\Container->build('craft\\web\\Appli...', Array, Array)
#48 /var/www/html/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\web\\Appli...', Array, Array)
#49 /var/www/html/vendor/craftcms/cms/bootstrap/bootstrap.php(244): yii\BaseYii::createObject(Array)
#50 /var/www/html/vendor/craftcms/cms/bootstrap/web.php(51): require('/var/www/html/v...')
#51 /var/www/html/web/index.php(20): require('/var/www/html/v...')
#52 {main}

Steps to reproduce

  1. Have a Craft site with MySQL.
  2. Use pgloader to migrate that data over to a new PostgreSQL database.

Additional info

brandonkelly commented 4 years ago

Sounds like the schemaVersion column in the info table became all-lowercase (schemaversion) during the conversion. There are several column names that use mixed case, so even if you fix this one, there are likely others too. Plus, the schema Craft uses for Postgres isn’t 100% identical to the one used for MySQL, so even if you get it converted correctly (with correct casing) you are still going to run into some other issues.

Good news is we are working on a script that can help with this conversion, so try writing into support@craftcms.com and we should be able to help you from there.

jeffreydwalter commented 4 years ago

@brandonkelly how's it coming with the migration script you guys are working on? I've got a MySQL install that I urgently need to migrate to Postgres.

brandonkelly commented 4 years ago

@jeffreydwalter Write into support@craftcms.com and we should be able to help.

jeffreydwalter commented 4 years ago

@brandonkelly supposedly, someone on my team has emailed you guys a couple of times over the last few days, but hasn't gotten a reply. I will shoot an email to you right now. Would really appreciate your help. Just need to migrate a MySQL database to Postgres.

angrybrad commented 4 years ago

I've "documented" our experience with this conversion process here in case people want to try it for themselves: https://craftcms.stackexchange.com/questions/35815/is-there-a-way-to-convert-a-craft-mysql-database-to-postgresql