M
M
Mikhail Trainin2020-12-14 14:58:01
Django
Mikhail Trainin, 2020-12-14 14:58:01

Django ORM, how to check if a field exists in a database?

There is a situation:

On different production servers, a different state of the tables in the database has turned out.
One server is missing a couple of fields in multiple tables.
The project uses the Django ORM.

Question:

How can I check the presence of these fields in the database with which the migrations interact, and if they are not there, then create them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-12-14
@bacon

Well, makemigrations calculates the difference and makes a file with migrations, which is accepted by migration. The question is, how did it happen that different states, migration files are not included in the source code or they were not used?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question