title: Can't drop a MySQL table due to foreign key constraints
body: <p>I have 2 tables created with </p>
  
  <pre><code>CREATE TABLE projs 
  (
      id          MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
      compname    VARCHAR (200), 
      title       VARCHAR (200), 
      imageurl    VARCHAR(300), 
      sumsmall    VARCHAR (250), 
      sumfull     VARCHAR (5000), 
      results     VARCHAR (2000), 
      postdate    TIMESTAMP DEFAULT CURRENT_TIMESTAMP, 
      caseid      MEDIUMINT NULL, 
      hide        TINYINT NOT NULL, 
      carid       MEDIUMINT, 
      FOREIGN KEY (caseid) REFERENCES cases(id) ON DELETE SET NULL, 
      FOREIGN KEY (carid) REFERENCES work_carousels(id) ON DELETE SET NULL
  )
  </code></pre>
  
  <p>and</p>
  
  <pre><code>CREATE TABLE cases 
  (
      id              MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
      compname        VARCHAR (200), 
      sumsmall        VARCHAR (500), 
      situation       VARCHAR (1000), 
      imageurl        VARCHAR(300), 
      approach        VARCHAR (1000), 
      deliverables    VARCHAR (1000), 
      results         VARCHAR (1000), 
      conclusion      VARCHAR (1000), 
      postdate        DATETIME DEFAULT CURRENT_TIMESTAMP, 
      carid           MEDIUMINT, 
      FOREIGN KEY (carid) REFERENCES work_carousels(id) ON DELETE SET NULL
  )
  </code></pre>
  
  <p>the important part being that there is a column in <code>projs</code> that references a column in <code>cases</code>. I get the error:</p>
  
  <blockquote>
    <p>#1217 - Cannot delete or update a parent row: a foreign key constraint fails</p>
  </blockquote>
  
  <p>when I try to </p>
  
  <pre><code>DROP TABLE cases;
  </code></pre>
  
  <p>which seems weird because I've configured the column <code>caseid</code> in <code>projs</code> to become <code>NULL</code> if what it's referencing gets deleted. I tried to manually set those values to <code>NULL</code>: </p>
  
  <pre><code>UPDATE projs SET caseid=NULL;
  DROP TABLE cases;
  </code></pre>
  
  <p>but got the same error. </p>
  
  <p>Any idea what I'm doing wrong?</p>