Learn how to generate a database migration based on the model definition in Django.
Create Migrations
Let’s say for example we have the following model definition in your app:
class thresholds(models.Model): name = models.CharField(max_length=300, blank=True) value = models.IntegerField()
The in the command line run:
python manage.py makemigrations
The migrations will be created.
Make sure the app is listed in the ‘INSTALLED_APPS’ list in settings.py
Run Migrations
python manage.py migrate