#1471: Error with sql generated when versioning used with composite key.
---------------------------------------------+------------------------------
Reporter: rscarriere | Owner: jwage
Type: defect | Status: new
Priority: minor | Milestone:
Component: Behaviors | Version: Trunk
Keywords: sql, versionable, composite key | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
---------------------------------------------+------------------------------
I have two tables with a one to many relationship - Organization and
Organization_Name (used when organizations have multiple aliases).
Organization has primary key organization_uid while Organization_Name has
a composite primary key of organization_uid + organization_num_seq (this
increments for each alias). The versionable behaviour is enabled on both
tables.
If I set organization_num_seq = 'true' and generate the sql it adds this
constraint:
{{{
ALTER TABLE organization_name ADD FOREIGN KEY (organization_uid,
organization_name_seq) REFERENCES
z_organization_name_version(organization_uid, organization_name_seq);
}}}
I cannot see any reason why I would want to add this foreign key. If I
remove this line before loading in the database it works as expected.
Setting organization_num_seq = 'false' obviously does not work because if
you try to add more than one alias you get a key violation.
I'm using Doctrine from inside the latest svn version of the
sfDoctrinePlugin
$Id: Doctrine.php 4950 2008-09-12 16:39:13Z jwage
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1471>
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
-~----------~----~----~----~------~----~------~--~---