Craft install throws errors while trying to install with empty db and prepopulated project yamls
@timkelty is already working on this.
Since Feb 10, 2022.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
Description
At our company we try to achieve the following cross developer experience:
- Developer A works for some weeks on some craftcms
- Developer A continuously pushes all the
config/project/changes into git - Developer B is new to the project
- Developer B checkouts the changes and wants to start developing
- Developer B has his db empty so craft needs to be installed
- Developer B gets errors while just trying to call
craft installeither from console or browser - Developer B frustration :(
- Developer B has to remove the
config/project/folder - Developer B installs craft without prepopulated
config/project/folder - Developer B restores the
config/project/folder - Developer B reapplies project yaml files and hopes all goes well
- Only after that Developer B can start making own progress
- Develop and repeat for Developer A-N.
This happened already quite often in our approach sharing development progress between different team members.
Most of the time we see Exception 'craft\errors\MigrationException' with message 'An error occurred while executing the "craft\migrations\Install migration: Calling unknown method: craft\console\Request::getParam()' right before craft install is able to finish.
See this for the whole console output: https://gist.github.com/jawys/51dc1fc7d773af93a94de9523d0d8b18#file-php_craft_install-log-L445
While searching for the origin of the errors trying to make a quickstart for new developers as easy as possible, we started removing plugins to mitigate issues with these.
But still, we cannot achieve a frictionless install while sharing only code between devs on different machines.
Do we need to share db dumps across us all as well?
Steps to reproduce
- Clone a craftcms git repo from your dev colleague
- Make sure you have a clean database
- Remove
plugins:section fromproject.yaml - Run
craft install - See this:
[...] *** installed Craft successfully (time: 24.037s) 2022-02-10 10:59:04 [-][-][-][error][craft\base\ApplicationTrait::getIsInstalled] There was a problem fetching the info row: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "info" does not exist LINE 2: FROM "info" ^ The SQL being executed was: SELECT * FROM "info" WHERE "id"=1 LIMIT 1 2022-02-10 10:59:04 [-][-][-][error][yii\db\Exception] PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "info" does not exist LINE 2: FROM "info" ^ in /app/vendor/yiisoft/yii2/db/Command.php:1302 Stack trace: #0 /app/vendor/yiisoft/yii2/db/Command.php(1302): PDOStatement->execute() #1 /app/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT *\nFROM "...') #2 /app/vendor/yiisoft/yii2/db/Command.php(424): yii\db\Command->queryInternal('fetch', NULL) #3 /app/vendor/yiisoft/yii2/db/Query.php(287): yii\db\Command->queryOne() #4 /app/vendor/craftcms/cms/src/db/Query.php(167): yii\db\Query->one(NULL) #5 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(671): craft\db\Query->one() #6 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(329): craft\console\Application->getInfo(true) #7 /app/vendor/craftcms/cms/src/helpers/App.php(758): craft\console\Application->getIsInstalled() #8 /app/vendor/craftcms/cms/src/config/app.php(245): craft\helpers\App::projectConfigConfig() #9 [internal function]: {closure}() #10 /app/vendor/yiisoft/yii2/di/Container.php(633): call_user_func_array(Object(Closure), Array) #11 /app/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->invoke(Object(Closure), Array) #12 /app/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure)) #13 /app/vendor/yiisoft/yii2/base/Module.php(766): yii\di\ServiceLocator->get('projectConfig', true) #14 /app/vendor/craftcms/cms/src/console/Application.php(158): yii\base\Module->get('projectConfig', true) #15 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1322): craft\console\Application->get('projectConfig') #16 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1508): craft\console\Application->getProjectConfig() #17 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1464): craft\console\Application->_setTimeZone() #18 /app/vendor/craftcms/cms/src/console/Application.php(46): craft\console\Application->_preInit() #19 /app/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init() #20 /app/vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->__construct(Array) #21 /app/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array) #22 [internal function]: yii\console\Application->__construct(Array) #23 /app/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs(Array) #24 /app/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('craft\\console\\A...', Array, Array) #25 /app/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\console\\A...', Array, Array) #26 /app/vendor/craftcms/cms/src/Craft.php(61): yii\BaseYii::createObject(Array, Array) #27 /app/vendor/craftcms/cms/bootstrap/bootstrap.php(246): Craft::createObject(Array) #28 /app/vendor/craftcms/cms/bootstrap/console.php(51): require('/app/vendor/cra...') #29 /app/craft(12): require('/app/vendor/cra...') #30 {main} Next yii\db\Exception: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "info" does not exist LINE 2: FROM "info" ^ The SQL being executed was: SELECT * FROM "info" WHERE "id"=1 LIMIT 1 in /app/vendor/yiisoft/yii2/db/Schema.php:676 Stack trace: #0 /app/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'SELECT *\nFROM "...') #1 /app/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT *\nFROM "...') #2 /app/vendor/yiisoft/yii2/db/Command.php(424): yii\db\Command->queryInternal('fetch', NULL) #3 /app/vendor/yiisoft/yii2/db/Query.php(287): yii\db\Command->queryOne() #4 /app/vendor/craftcms/cms/src/db/Query.php(167): yii\db\Query->one(NULL) #5 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(671): craft\db\Query->one() #6 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(329): craft\console\Application->getInfo(true) #7 /app/vendor/craftcms/cms/src/helpers/App.php(758): craft\console\Application->getIsInstalled() #8 /app/vendor/craftcms/cms/src/config/app.php(245): craft\helpers\App::projectConfigConfig() #9 [internal function]: {closure}() #10 /app/vendor/yiisoft/yii2/di/Container.php(633): call_user_func_array(Object(Closure), Array) #11 /app/vendor/yiisoft/yii2/BaseYii.php(349): yii\di\Container->invoke(Object(Closure), Array) #12 /app/vendor/yiisoft/yii2/di/ServiceLocator.php(137): yii\BaseYii::createObject(Object(Closure)) #13 /app/vendor/yiisoft/yii2/base/Module.php(766): yii\di\ServiceLocator->get('projectConfig', true) #14 /app/vendor/craftcms/cms/src/console/Application.php(158): yii\base\Module->get('projectConfig', true) #15 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1322): craft\console\Application->get('projectConfig') #16 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1508): craft\console\Application->getProjectConfig() #17 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(1464): craft\console\Application->_setTimeZone() #18 /app/vendor/craftcms/cms/src/console/Application.php(46): craft\console\Application->_preInit() #19 /app/vendor/yiisoft/yii2/base/BaseObject.php(109): craft\console\Application->init() #20 /app/vendor/yiisoft/yii2/base/Application.php(204): yii\base\BaseObject->__construct(Array) #21 /app/vendor/yiisoft/yii2/console/Application.php(89): yii\base\Application->__construct(Array) #22 [internal function]: yii\console\Application->__construct(Array) #23 /app/vendor/yiisoft/yii2/di/Container.php(419): ReflectionClass->newInstanceArgs(Array) #24 /app/vendor/yiisoft/yii2/di/Container.php(170): yii\di\Container->build('craft\\console\\A...', Array, Array) #25 /app/vendor/yiisoft/yii2/BaseYii.php(365): yii\di\Container->get('craft\\console\\A...', Array, Array) #26 /app/vendor/craftcms/cms/src/Craft.php(61): yii\BaseYii::createObject(Array, Array) #27 /app/vendor/craftcms/cms/bootstrap/bootstrap.php(246): Craft::createObject(Array) #28 /app/vendor/craftcms/cms/bootstrap/console.php(51): require('/app/vendor/cra...') #29 /app/craft(12): require('/app/vendor/cra...') #30 {main} Additional Information: Array ( [0] => 42P01 [1] => 7 [2] => ERROR: relation "info" does not exist LINE 2: FROM "info" ^ ) 2022-02-10 10:59:04 [-][-][-][error][craft\base\ApplicationTrait::getIsInstalled] There was a problem fetching the info row: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "public.info" does not exist LINE 2: FROM public."info" ^ The SQL being executed was: SELECT EXISTS(SELECT * FROM public."info" WHERE "id"=1) 2022-02-10 10:59:04 [-][-][-][error][yii\db\Exception] PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "public.info" does not exist LINE 2: FROM public."info" ^ in /app/vendor/yiisoft/yii2/db/Command.php:1302 Stack trace: #0 /app/vendor/yiisoft/yii2/db/Command.php(1302): PDOStatement->execute() #1 /app/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT EXISTS(S...') #2 /app/vendor/yiisoft/yii2/db/Command.php(436): yii\db\Command->queryInternal('fetchColumn', 0) #3 /app/vendor/yiisoft/yii2/db/Query.php(446): yii\db\Command->queryScalar() #4 /app/vendor/craftcms/cms/src/db/Query.php(213): yii\db\Query->exists(NULL) #5 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(325): craft\db\Query->exists() #6 /app/vendor/craftcms/cms/src/console/controllers/InstallController.php(104): craft\console\Application->getIsInstalled(true) #7 [internal function]: craft\console\controllers\InstallController->actionCraft() #8 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #9 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array) #10 /app/vendor/yiisoft/yii2/console/Controller.php(182): yii\base\Controller->runAction('', Array) #11 /app/vendor/craftcms/cms/src/console/Controller.php(221): yii\console\Controller->runAction('', Array) #12 /app/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('', Array) #13 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('install', Array) #14 /app/vendor/craftcms/cms/src/console/Application.php(89): yii\console\Application->runAction('install', Array) #15 /app/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('install', Array) #16 /app/vendor/yiisoft/yii2/base/Application.php(384): yii\console\Application->handleRequest(Object(craft\console\Request)) #17 /app/craft(13): yii\base\Application->run() #18 {main} Next yii\db\Exception: SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "public.info" does not exist LINE 2: FROM public."info" ^ The SQL being executed was: SELECT EXISTS(SELECT * FROM public."info" WHERE "id"=1) in /app/vendor/yiisoft/yii2/db/Schema.php:676 Stack trace: #0 /app/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'SELECT EXISTS(S...') #1 /app/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT EXISTS(S...') #2 /app/vendor/yiisoft/yii2/db/Command.php(436): yii\db\Command->queryInternal('fetchColumn', 0) #3 /app/vendor/yiisoft/yii2/db/Query.php(446): yii\db\Command->queryScalar() #4 /app/vendor/craftcms/cms/src/db/Query.php(213): yii\db\Query->exists(NULL) #5 /app/vendor/craftcms/cms/src/base/ApplicationTrait.php(325): craft\db\Query->exists() #6 /app/vendor/craftcms/cms/src/console/controllers/InstallController.php(104): craft\console\Application->getIsInstalled(true) #7 [internal function]: craft\console\controllers\InstallController->actionCraft() #8 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #9 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array) #10 /app/vendor/yiisoft/yii2/console/Controller.php(182): yii\base\Controller->runAction('', Array) #11 /app/vendor/craftcms/cms/src/console/Controller.php(221): yii\console\Controller->runAction('', Array) #12 /app/vendor/yiisoft/yii2/base/Module.php(552): craft\console\Controller->runAction('', Array) #13 /app/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('install', Array) #14 /app/vendor/craftcms/cms/src/console/Application.php(89): yii\console\Application->runAction('install', Array) #15 /app/vendor/yiisoft/yii2/console/Application.php(147): craft\console\Application->runAction('install', Array) #16 /app/vendor/yiisoft/yii2/base/Application.php(384): yii\console\Application->handleRequest(Object(craft\console\Request)) #17 /app/craft(13): yii\base\Application->run() #18 {main} Additional Information: Array ( [0] => 42P01 [1] => 7 [2] => ERROR: relation "public.info" does not exist LINE 2: FROM public."info" ^ ) - Point your browser to your local craft installation (in our case http://localhost:8080)
- Refresh the site if you are on the
/admin/installscreen - Does work actually?!
Additional info
- Craft version: 3.7.32
- PHP version: 8.0.14
- Database driver & version: PostgreSQL 13.5
- Plugins & versions: None as we remove them prior to install to mitigate issues
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.