title: Column does not exist error when adding Foreign Key Django
body: <p>I can't seem to figure this issue out. I had a bunch of models in django and then after I loaded some data I decided to add a foreign key to two of the models. I ran the schemamigration and I was told that I needed to specify a default value and I specified ''. The migration worked, but now anytime I try to use one of those tables I get an error. </p>
  
  <p>"Column myapp_mytable.myforiegnkey_id does not exist". </p>
  
  <p>I've flushed the database, dropped all the tables, deleted all the migration files, and none of that works. </p>
  
  <p>Below is the relevant code for the two models that won't work. </p>
  
  <pre><code>class TLOQuery(models.Model):
      searchData = models.ForeignKey(Search, blank=True, null=True)
  
  class TLOPersonSearchOutput(models.Model):
      searchQuery= models.ForeignKey(TLOQuery, blank=True, null=True)
  </code></pre>
  
  <p>Note: There have been a few other error messages. Initially it was telling me that I couldn't alter the field myforiengkey because it did not exist. It has also told me that the entire table does not exist. But since flushing the database, and dropping all the tables and deleting all the migrations, I get the above error whenever I try to call some command on the table like </p>
  
  <pre><code>print(myModel1.objects.all())
  </code></pre>
  
  <p>Any suggestions would be greatly appreciated!</p>
  
  <p>EDIT: Here is the actual message. </p>
  
  <pre><code>In [5]: print (TLOQuery.objects.all())
  ---------------------------------------------------------------------------
  ProgrammingError                          Traceback (most recent call last)
  &lt;ipython-input-5-634eb4f16f42&gt; in &lt;module&gt;()
  ----&gt; 1 print (TLOQuery.objects.all())
  
  /usr/local/lib/python2.7/dist-packages/django/db/models/query.pyc in __repr__(self)
       69
       70     def __repr__(self):
  ---&gt; 71         data = list(self[:REPR_OUTPUT_SIZE + 1])
       72         if len(data) &gt; REPR_OUTPUT_SIZE:
       73             data[-1] = "...(remaining elements truncated)..."
  
  /usr/local/lib/python2.7/dist-packages/django/db/models/query.pyc in __iter__(self)
       94                - Responsible for turning the rows into model objects.
       95         """
  ---&gt; 96         self._fetch_all()
       97         return iter(self._result_cache)
       98
  
  /usr/local/lib/python2.7/dist-packages/django/db/models/query.pyc in _fetch_all(self)
      852     def _fetch_all(self):
      853         if self._result_cache is None:
  --&gt; 854             self._result_cache = list(self.iterator())
      855         if self._prefetch_related_lookups and not self._prefetch_done:
      856             self._prefetch_related_objects()
  
  /usr/local/lib/python2.7/dist-packages/django/db/models/query.pyc in iterator(self)
      218             klass_info = get_klass_info(model, max_depth=max_depth,
      219                                         requested=requested, only_load=only_load)
  --&gt; 220         for row in compiler.results_iter():
      221             if fill_cache:
      222                 obj, _ = get_cached_row(row, index_start, db, klass_info,
  
  /usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.pyc in results_iter(self)
      708         fields = None
      709         has_aggregate_select = bool(self.query.aggregate_select)
  --&gt; 710         for rows in self.execute_sql(MULTI):
      711             for row in rows:
      712                 if has_aggregate_select:
  
  /usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.pyc in execute_sql(self, result_type)
      779
      780         cursor = self.connection.cursor()
  --&gt; 781         cursor.execute(sql, params)
      782
      783         if not result_type:
  
  /usr/local/lib/python2.7/dist-packages/django/db/backends/util.pyc in execute(self, sql, params)
       67         start = time()
       68         try:
  ---&gt; 69             return super(CursorDebugWrapper, self).execute(sql, params)
       70         finally:
       71             stop = time()
  
  /usr/local/lib/python2.7/dist-packages/django/db/backends/util.pyc in execute(self, sql, params)
       51                 return self.cursor.execute(sql)
       52             else:
  ---&gt; 53                 return self.cursor.execute(sql, params)
       54
       55     def executemany(self, sql, param_list):
  
  /usr/local/lib/python2.7/dist-packages/django/db/utils.pyc in __exit__(self, exc_type, exc_value, traceback)
       97                 if dj_exc_type not in (DataError, IntegrityError):
       98                     self.wrapper.errors_occurred = True
  ---&gt; 99                 six.reraise(dj_exc_type, dj_exc_value, traceback)
      100
      101     def __call__(self, func):
  
  /usr/local/lib/python2.7/dist-packages/django/db/backends/util.pyc in execute(self, sql, params)
       51                 return self.cursor.execute(sql)
       52             else:
  ---&gt; 53                 return self.cursor.execute(sql, params)
       54
       55     def executemany(self, sql, param_list):
  
  ProgrammingError: column icesl_tloquery.searchData_id does not exist
  LINE 1: SELECT "icesl_tloquery"."id", "icesl_tloquery"."searchData_i...
  </code></pre>