title: Deleting a table from MySQL database in Django manually
body: <p>During my experimentation with my blog app (<code>blogapp</code>) in Django, I created two models (Category and Language), connected them to another model (<code>Post</code>) using following connections:</p>
  
  <pre><code>category = models.ManyToManyField(Category)
  language = models.ForeignKey(Language)
  </code></pre>
  
  <p>Then it gave an error like <a href="https://stackoverflow.com/q/937954/2275286">THIS</a> due to the lack of default value. Tried to roll that back by using an amalgam of <a href="https://stackoverflow.com/a/29046154/2275286">THIS</a> and <a href="https://stackoverflow.com/a/32124113/2275286">THIS</a>. Then I tried to add a default value using <a href="https://code.djangoproject.com/ticket/6445" rel="nofollow noreferrer">THIS</a>. I've got an error <code>"django.db.utils.OperationalError 1050, Table XXX already exists"</code>, then I tried <a href="https://stackoverflow.com/a/25925368/2275286">THIS</a>. Tried to revert back migrations by deleting the created migrations from the migrations folder manually. At some point I got django <code>(1054, "Unknown column in 'field list")</code> error. </p>
  
  <p>Finally I decided to revert back to my original starting place. When I connect to my MySQL database using <code>python manage.py dbshell</code>, I realized that my MySQL server still have two tables that should have been deleted, <code>blogapp_category</code> and <code>blogapp_language</code>. Server is working properly but I keep getting <code>"Table XXX already exists"</code> error when I try to add those models. </p>
  
  <p>Dropping tables from MySQL seems to be the only option at the moment.
  When I run </p>
  
  <pre><code>mysql&gt; SHOW COLUMNS FROM blogapp_post;
  </code></pre>
  
  <p>I did not see any reference to language or category, i.e. no columns named <code>language_id</code> or <code>category_id</code>. I have two questions at the moment:</p>
  
  <ol>
  <li><p>Is it safe to delete tables manually using:</p>
  
  <p>DROP TABLE blogapp_language;
  DROP TABLE blogapp_category;</p></li>
  </ol>
  
  <p>Will there be any negative effects?</p>
  
  <ol start="2">
  <li>Is there a way to freeze database like git so that when I revert to the old database, such tables added to the database by django migrations automatically dropped??</li>
  </ol>