title: Symfony sfDoctrineGuard insert-sql error 1005
body: <p>I've fresh isntall of Symfony 1.4 with Doctrine ORM.</p>
  
  <p>I'm looking to install the plugin sfDoctrineGuard.  I followed the instructions here:
  <a href="http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin" rel="nofollow">http://www.symfony-project.org/plugins/sfDoctrineGuardPlugin</a></p>
  
  <p>all works fine until this step:
  symfony doctrine:insert-sql</p>
  
  <p>when I get an error:</p>
  
  <blockquote>
    <p>SQLSTATE[HY000]: General error: 1005 Can't create table 'kickboxing.#sql-2b5b_a8f' (error 150) Failing Query "ALTER TABLE profile ADD CONSTRAINT profile_sf_guard_user_id_sf_guard_user_id FOREIGN KEY (sf_guard_user_id) REFERENCES sf_guard_user(id)</p>
  </blockquote>
  
  <p>It did seem to create some tables:</p>
  
  <p>profile
  sf_guard_forgot_password
  sf_guard_group
  sf_guard_group_permission
  sf_guard_permission
  sf_guard_remember_key
  sf_guard_user
  sf_guard_user_group
  sf_guard_user_permission</p>
  
  <p>any ideas?</p>
  
  <p>UPDATE:
  I'm after spotting this really has nothign to do with doctrine/symfony. The issue seems to be with mysql I ran the alter command above in MySQL and of course I get same error.</p>
  
  <p>For reference on that I've Debian Squeeze installed and mysql 5. </p>
  
  <p>UPDATE2 :
  when i run </p>
  
  <pre><code>SHOW INNODB STATUS;
  </code></pre>
  
  <p>I get </p>
  
  <blockquote>
    <hr>
    
    <h2>LATEST FOREIGN KEY ERROR</h2>
    
    <p>110927  7:58:35 Error in foreign key constraint of table _kickboxing/#sql-2b5b_a86:
    FOREIGN KEY (sf_guard_user_id) REFERENCES sf_guard_user(id):
    Cannot find an index in the referenced table where the
    referenced columns appear as the first columns, or column types
    in the table and the referenced table do not match for constraint.
    Note that the internal storage type of ENUM and SET changed in
    tables created with >= InnoDB-4.1.12, and such columns in old tables
    cannot be referenced by such columns in new tables.
    See <a href="http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html</a>
    for correct foreign key definition.</p>
  </blockquote>