出于集成测试目的,我正在尝试为测试环境创建一个 sqlite db,但是当我运行时,php bin/console doctrine:schema:create --env=test我收到表已经存在的错误。我想是因为它并没有真正创建一个新的测试数据库,而是继续现有的数据库。看起来它不是从 env.test 读取的。我doctrine.yaml在配置/测试中创建了一个这样的:doctrine:dbal: driver: 'pdo_sqlite' url: 'sqlite:///%kernel.project_dir%/var/data/test.sqlite'创建sqlite测试数据库我缺少什么?我在错误中遇到的奇怪事情:In PDOConnection.php line 90: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'user_menu' already exists 为什么是 SQL?不应该是 SQLite 的 IT,对吗?在 config/packages/doctrine.yaml 中,我有:parameters:# Adds a fallback DATABASE_URL if the env var is not set.# This allows you to run cache:warmup even if your# environment variables are not available yet.# You should not need to change this value.env(DATABASE_URL): ''doctrine:dbal: # configure these for your database server connections: gui: driver: 'pdo_mysql' server_version: '5.7' charset: utf8mb4 default_table_options: charset: utf8mb4 collate: utf8mb4_unicode_ci url: '%env(resolve:DATABASE_GUI_URL)%' upv6: driver: 'pdo_mysql' server_version: '5.7' charset: utf8mb4 default_table_options: charset: utf8mb4 collate: utf8mb4_unicode_ci url: '%env(resolve:DATABASE_UPV6_URL)%'orm: auto_generate_proxy_classes: true # <- change to true proxy_dir: '%kernel.cache_dir%/doctrine/orm/Proxies' proxy_namespace: Proxies entity_managers: gui: connection: gui mappings: Gui: is_bundle: false type: annotation dir: '%kernel.project_dir%/src/Entity/Gui' prefix: 'App\Entity\Gui'
1 回答
- 1 回答
- 0 关注
- 126 浏览
添加回答
举报
0/150
提交
取消