Integration of the old mySQL database into a new data structure based on Django ORM

We have a Django project that we have been working on over the past few months, and this is basically a new, improved version of the old system that PHP and mySQL are running on.

Now I need to convert all the old data from mySQL tables into a new Django-ORM based data structure.

I have already created a new name for the Django project "integration" and launched

pytohn django-admin.py inspectdb > models.py

The result was not so good, because we used the MyISAM DB mechanism, and there is no clear relationship between the models.

In addition, in their design, the models are very different from each other, although the bottom line is the same (the same data is presented differently).

Questions:

  • First of all, whether this problem can be theoretically solved in this way, exclusively through southern migrations from here.

  • How can I lose the id column (PK = true) and the database_name attribute in the Meta class from the output of the db check without breaking it.

  • When pre-formatting the main changes in the models (several fields at a time, name, length and type in general for each), it is all the same to directly indicate to the sub which field, therefore, the data in the existing columns will be correctly transferred.

It is clear that this is my first integration project of this magnitude, so sorry for all the uninformed questions.

What approach would you recommend ?, any tools to help me?

Is it better to go by induction (from a larger, more central object to smaller ones) or by deduction (vice versa)?

+4
1

, , , , , . , db, , MySQL ISAM - , , .

, , ForeignKey IntegerFields. IntegerField to ForeignKey , IIRC. , , .

, : : Django

: WordPress Django Admin.

, , Django - , , !:)

!

+1

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


All Articles