DDC-838: SchemaTool - ignores the attribute uniq in relations #5358

Open
doctrinebot opened this Issue Oct 13, 2010 · 3 comments

1 participant

@doctrinebot

Jira issue originally created by user gektor:

<entity name="Default*Model*Test" table="test">
  <id name="id" type="integer" column="id">
    <generator strategy="AUTO"/>
  </id>
  <field name="blabla" column="blabla" type="boolean"/>
  <one-to-one field="user" target-entity="Users*Model*User">
    <join-column name="users_id" referenced-column-name="id" on-delete="CASCADE" on-update="CASCADE" unique="false" />
  </one-to-one>
</entity>
CREATE TABLE test (id INT AUTO*INCREMENT NOT NULL, users_id INT DEFAULT NULL, blabla TINYINT(1) NOT NULL, UNIQUE INDEX test_users_id_uniq (users*id), PRIMARY KEY(id)) ENGINE = InnoDB;
ALTER TABLE test ADD FOREIGN KEY (users_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE CASCADE;

Actual:
UNIQUE INDEX testusers_id_uniq (usersid)

Expected:
INDEX testusers_id (usersid)

@doctrinebot

Comment created by @beberlei:

Verified, i just don't understand why you are using a one-to-one relation and then "deactivate" the database constraint for this. You could easily use Many-To-One

@doctrinebot

Comment created by gektor:

You are right. It's not a bug, it's feature.

@doctrinebot

Comment created by @beberlei:

This might still be a good improvement to allow the flexibility, but its not a bug. Updating to "Minor Improvmenet for 2.x"

@doctrinebot doctrinebot added this to the 2.x milestone Dec 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment