#1691: Long table and column names result in FK constraint names 'too long' for
MySQL
---------------------------------------+------------------------------------
Reporter: popthestack | Owner: guilhermeblanco
Type: defect | Status: new
Priority: minor | Milestone: 1.1.0
Component: Relations | Version: 1.1-DEV
Keywords: foreign keys, constraints | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 1
---------------------------------------+------------------------------------
MySQL has a FK constraint name limit of 64 characters. When Doctrine 1.1
creates the FK constraint name for these two tables, the resulting name is
99 characters, resulting in an SQL error.
table1: item_subattribute_names_to_item_attribute_sets
column1: item_subattribute_name_id
table2: item_subattribute_names
column2: id
FK name:
item_subattribute_names_to_item_attribute_sets_item_subattribute_name_id_item_subattribute_names_id
Perhaps the name should just be cut off if the strlen() is too bit, but
here's what I did instead...
The attached patch allows you to customize the names of the FK constraints
with setAttribute().
Concerning the patch:
- I have no idea if I've done this right, but it works. :)
- I certainly won't be offended if it's rejected or changed completely.
I'm new to coding for Doctrine.
- ATTR_DEFAULT_FK_OPTIONS takes an array instead of a string, even though
there's only one option that can be configured, since further options can
be added to it. Not really sure.
--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1691>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---