Database Maintenance

When you deploy your app, you may want to make changes to the database. For example, what if all of a sudden, we want to allow a user to dislike a Post? We'd likely need a new table! But our database doesn't have that table! So we'd need to tell our database that we've made changes to it in our code.

We do so by the following commands:

python manage.py makemigrations

makemigrations basically tells Django that you're made changes and asks it to take note of the changes you made (will only work if you added the app to the installed_apps of the settings.py)

python manage.py migrate

migrate tells django to implement the changes that it took note of in makemigrations.

results matching ""

    No results matching ""