我正在尝试使用教义orm和其他人构建的应用程序创建数据库。我遇到数据库错误,不确定是否对概念不清楚,或者是否需要调整注释。
命令和输出:
php bin/console doctrine:schema:validate
Mapping
-------
[OK] The mapping files are correct.
Database
--------
15:06:28 ERROR [console] Error thrown while running command "doctrine:schema:validate". Message: "Invalid index-name unique_organization_id_application_id given, has to be [a-zA-Z0-9_]" ["error" => Doctrine\DBAL\Schema\SchemaException { …},"command" => "doctrine:schema:validate","message" => "Invalid index-name unique_organization_id_application_id given, has to be [a-zA-Z0-9_]"] []
[Doctrine\DBAL\Schema\SchemaException]
Invalid index-name unique_organization_id_application_id given, has to be [a-zA-Z0-9_]
听起来好像数据库设置不正确(尽管我认为这是设置数据库架构之前的第一步)
注释:
@ORM\Table(name="applications", uniqueConstraints={@UniqueConstraint(name="unique_organization_id_application_id", columns={"organization_id", "application_id"})})
这就是我不擅长的地方。 organizationId
和applicationId
都是该类的私有成员,带有getter和setter。在课程的任何地方都找不到unique_organization_id_application_id
。
答案 0 :(得分:1)
给出的无效索引名称unique_organization_id_application_id必须为[a-zA-Z0-9 _]
该错误表明您在索引名称中插入了一些非英语字母。尝试完全删除该名称。