How to prepare django migrations?

Migrating data in django involves two steps:

python manage.py makemigrations
python manage.py migrate

The first step prepares migrations that, as far as I know, are database specific; that is, depending on which database backend you are going to use, you will receive different migrations.

If I use in development sqlite, but in the production process, postgresdoes this mean that the migration that I prepare in development will not work for the production machine?

+4
source share
1 answer

Migrations created by the makemigrations team are database independent; they can be run in any database.

python manage.py sqlmigrate # which displays the SQL statements for a migration

From the Django Doc:

, , , , ,

@Klaus D. , Django , .

+1

Source: https://habr.com/ru/post/1696346/


All Articles