Reputation: 1088
I'm trying to configure phpcr_odm with Symfony 2.8 using Oracle database from
this link. When I'm trying to run php app/console doctrine:schema:create
my console returns error
[Doctrine\DBAL\Exception\DriverException]
An exception occurred while executing 'CREATE UNIQUE INDEX UNIQ_37E65615460D9FD7413BC13C1AC10DC4E7087E10 ON phpc
r_binarydata (node_id, property_name, workspace_name, idx)':
ORA-00972: identifier is too long
[Doctrine\DBAL\Driver\OCI8\OCI8Exception]
ORA-00972: identifier is too long
I know that Oracle SQL limits unique indexes for 30 chars but I don't know how to limit unique indexes before they are executed in symfony. Can somebody please tell me how to fix this issue ?
Best Regards
Upvotes: 2
Views: 358
Reputation: 244
In SQL-92 the later version of the standard appears to optionally allow for 128 character names. Otherwise this would be the solution: https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Schema/AbstractAsset.php#L219
Upvotes: 0
Reputation: 1068
If you declare the unique constraint on your entity yourself you can set its name manually:
@ORM\Table(name="phpcr_binarydata", uniqueConstraints={@ORM\UniqueConstraint(name="SMALL_KEY_NAME_HERE", columns={"node_id", "property_name", "workspace_name", "idx"})})
If the database creation is not under your control the maximum identifier length is configured in Doctrine\DBAL\Schema\SchemaConfig::$maxIdentifierLength
which you could try to extend and override.
Upvotes: 2