title: Getting errors while trying to run manage.py migrate
body: <p>When I run  <code>makemigrations</code> there's no problem at all. But when trying to run <code>migrate</code>, the below error occurs. </p>
  
  <pre><code>django.db.utils.IntegrityError: The row in table 'main_tutorial' with primary key
  '1' has an invalid foreign key: main_tutorial.tutorial_series_id contains a value '1'
  that does not have a corresponding value in main_tutorialseries.id.
  </code></pre>
  
  <p>Here's my <code>makemigrations</code> output.</p>
  
  <pre><code>&gt; python manage.py makemigrations
  Migrations for 'main':
  main\migrations\0005_auto_20200507_1813.py
  
  - Create model TutorialCategory
  - Add field tutorial_slug to tutorial
  - Alter field tutorial_published on tutorial
  - Create model TutorialSeries
  - Add field tutorial_series to tutorial
  </code></pre>
  
  <p>And when I run <code>python manage.py migrate</code>:</p>
  
  <pre><code>    Operations to perform:
         Apply all migrations: admin, auth, contenttypes, main, sessions
        Running migrations:
  
        Applying main.0005_auto_20200507_1813...Traceback (most recent call last):
       File "manage.py", line 15, in &lt;module&gt;
       execute_from_command_line(sys.argv)
       File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
       ages\django\core\management\__init__.py", line 401, in execute_from_command_line
  
        utility.execute()
        File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
      ages\django\core\management\__init__.py", line 395, in execute
       self.fetch_command(subcommand).run_from_argv(self.argv)
         File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
       ages\django\core\management\base.py", line 328, in run_from_argv
       self.execute(*args, **cmd_options)
     File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
       ages\django\core\management\base.py", line 369, in execute
        output = self.handle(*args, **options)
         File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
         ages\django\core\management\base.py", line 83, in wrapped
     res = handle_func(*args, **kwargs)
     File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
  ages\django\core\management\commands\migrate.py", line 231, in handle
      post_migrate_state = executor.migrate(
    File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
  ages\django\db\migrations\executor.py", line 117, in migrate
      state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_i
   nitial=fake_initial)
     File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
   ages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
      state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_
    initial)
     File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
   ages\django\db\migrations\executor.py", line 247, in apply_migration
       migration_recorded = True
      File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
    ages\django\db\backends\sqlite3\schema.py", line 35, in __exit__
      self.connection.check_constraints()
       File "C:\Users\Toshiba\AppData\Local\Programs\Python\Python38-32\lib\site-pack
     ages\django\db\backends\sqlite3\base.py", line 326, in check_constraints
      raise utils.IntegrityError(
     django.db.utils.IntegrityError: The row in table 'main_tutorial' with primary ke
      y '1' has an invalid foreign key: main_tutorial.tutorial_series_id contains a va
     lue '1' that does not have a corresponding value in main_tutorialseries.id.
  </code></pre>
  
  <p>Can anyone help me understand why the above errors occur?</p>