OperationalError, no such column.

OperationalError at /orders/
no such column: orders.customer_id
Request Method: GET
Request URL: http://localhost:9000/orders/
Django Version: 3.1.2
Exception Type: OperationalError
Exception Value:
no such column: orders.customer_id
Exception Location: /Users/xxx/django/db/backends/sqlite3/base.py in execute, line 355
Python Executable: /Users/xxx/Programs/Python/Python38-32
Python Version: 3.8.1

You are trying to add a non-nullable field ‘customer_id’ to snippet without a default;
we can’t do that (the database needs something to populate existing rows).
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows)
2) Quit, and let me add a default in models.py

In Django 1.7, the functionality of an app was integrated directly into Django. When working with migrations, the process is a bit different.
Make changes to models.py as usual.
Create a migration. This generates code to go from the current state to the next state of your model. This is done with the “makemigrations my-app-name” command. This command is smart enough to detect what has changed and will create a script to effect that change to your database.
Next, you apply that migration with “manage.py migrate” command. This command applies all migrations in order.

Step 1: Delete all the migration records from your app’s migration directory. These are files named 0001_,0002_,0003_ etc. Be careful as to not delete the _init__.py file.
Step 2 : Delete the db.sqlite3 file. It will be regenerated later.

Then run the following commands:

$python manage.py makemigrations your-app-name
$python manage.py migrate (new db.sqlite3 will be generated automatically)

Be sure to write the name of your app after makemigrations. You might have to create a superuser to access your database again. Do so by the following:

$python manage.py createsuperuser