首页 > 解决方案 > 为什么 Travis-CI 和 composer 在 clear:cache (Symfony) 期间执行查询

问题描述

我尝试用 symfony 配置 Travis-ci(不容易!)。当我运行 composer install 时,刚下载完所有包,composer 尝试清除缓存,并执行 SQL 查询(为什么?),但找不到表(迁移命令在之后)。我不明白,为什么作曲家尝试执行查询。

这是 travisci.yml 中的代码:

install:
  - cp .env.dist .env
  - mysql -e 'create database testing;'
  - composer install

after_install:
- php ./bin/console doctrine:migrations:diff
- php ./bin/console doctrine:migrations:migrate --no-interaction
#- php bin/console doctrine:migrations:migrate
#- php bin/console doctrine:fixtures:load -n --env=test
#- ./vendor/bin/simple-phpunit install
- ./bin/phpunit install

结果:

ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!  
!!   // Clearing the cache for the dev environment with debug                       
!!   // true                                                                        
!!  
!!  
!!  In AbstractMySQLDriver.php line 62:
!!                                                                                 
!!    An exception occurred while executing 'SELECT t0.id AS id_1, t0.created AS   
!!    created_2, t0.updated AS updated_3, t0.name AS name_4, t0.source AS source_  
!!    5 FROM twig_template t0 WHERE t0.name = ? LIMIT 1' with params [{}]:         
!!                                                                                 
!!    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testing.twig_tem  
!!    plate' doesn't exist                                                         
!!                                                                                 
!!  
!!  In PDOStatement.php line 144:
!!                                                                                 
!!    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testing.twig_tem  
!!    plate' doesn't exist                                                         
!!                                                                                 
!!  
!!  In PDOStatement.php line 142:
!!                                                                                 
!!    SQLSTATE[42S02]: Base table or view not found: 1146 Table 'testing.twig_tem  
!!    plate' doesn't exist                                                         
!!

或详细信息:https ://travis-ci.org/Dannebicque/intranetV3/builds/455840273

谢谢你的帮助大卫

标签: symfonycomposer-phptravis-ci

解决方案


推荐阅读