title: How to stop Doctrine2 Migrations:Diff from always adding foreign key relationships that already exist in Database?
body: <p>I'm using doctrine2 with a symfony2.1 project. I have an entity that has a few many to one relationships to other tables. The foreign key relationships for these many-to-one's have already been updated in the database, but every time I run migrations:diff or schema:update --dump-sql it adds the same update commands to add the foreign key relationships again. When I run schema:validate it says my mapping is out of sync with my database. </p>
  
  <p>My application works fine, the relationships are working properly, and the schema in my database looks correct. Why is doctrine still trying to add these foreign keys?</p>
  
  <p>Here's my code (for one of the problematic parameters):</p>
  
  <p>In my "Ticket" entity I have:</p>
  
  <pre><code>/**
   * Authenticated User who scored the ticket. 
   *
   * @ORM\ManyToOne(targetEntity="CS\SecurityBundle\Entity\User")
   * @ORM\JoinColumn(name="scoring_user_id", referencedColumnName="id")
   */
  protected $scoringUser;
  </code></pre>
  
  <p>I currently have it set up to be one-directional, so there is no inversedBy in the User entity.</p>
  
  <p>This generates the following in my migrations or schema:update dump even though it's in the database already:</p>
  
  <pre><code>$this-&gt;addSql("ALTER TABLE tickets ADD CONSTRAINT FK_54469DF4BB0D9452 FOREIGN KEY (scoring_user_id) REFERENCES users (id)");
  </code></pre>
  
  <p>Any idea what I'm doing wrong here?</p>