In Django, how can you add a column to an existing model’s database table?

  • Create a new model and migrate it
  • Directly modify the database schema
  • Django doesn't support adding columns to existing models
  • Use the "makemigrations" command
In Django, you can add a column to an existing model's database table by using the "makemigrations" command to create a migration and then applying it with "migrate." Modifying the database schema directly is not recommended.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *