Not sure if the following is a bug (which I hope) or some strange
feature that I don't understand.
Using the latest trunk of symfony and sfDoctrinePlugin, consider the
following very simple example schema:
[code]
Entity:
columns:
id:
type: integer(4)
primary: true
name: string
E1:
columns:
id:
type: integer(4)
primary: true
value:
type: integer(4)
primary: false
relations:
Entity:
local: id
foreign: id
onDelete: cascade
[/code]
The generated SQL (for MySQL) is:
[code]
CREATE TABLE entity (id INT, name TEXT, PRIMARY KEY(id)) ENGINE =
INNODB;
CREATE TABLE e1 (id INT, value INT, PRIMARY KEY(id)) ENGINE = INNODB;
[/code]
Why is there no FOREIGN KEY constraint defined with the ON DELETE
CASCADE action?
If making a simple change in the above schema, by for an example also
including the 'value' in the primary key, by changing the line
"primary: false" to "primary: true", we instead get the following
(expected) result:
[code]
CREATE TABLE entity (id INT, name TEXT, PRIMARY KEY(id)) ENGINE =
INNODB;
CREATE TABLE e1 (id INT, value INT, PRIMARY KEY(id, value)) ENGINE =
INNODB;
ALTER TABLE e1 ADD FOREIGN KEY (id) REFERENCES entity(id) ON DELETE
CASCADE;
[/code]
Why is the foreign key ignored in the first case when I want a one-to-
one relationship enforced between the two tables?
I tried the same schema with propel, and there the generated SQL
indeed does contain the foreign key constraint as I expected.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" 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.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---