[Fixed]-Is foreign key reference stored at django level or MySQLDB

1👍

The ORM is just a higher level way of working with the database, its schema, and retrieving its data. It doesn’t store anything, it just provides you a way of working with the data below as defined in the schema.

You can see in the schema you’ve shown here that table2 has a table1_id.

The very first line in the documentation for migrations:

Migrations are Django’s way of propagating changes you make to your models (adding a field, deleting a model, etc.) into your database schema.

So however you get there, at the end of it, you’re left with a database schema that has nothing at all to do with Django.

👤Sayse

0👍

How are they supposed to be related? Table1_id looks like the reference to the other table.

How should table1_id be populated? If it is all manual entry, then there should be no problem.

👤Marco

Leave a comment