I have an existing application written in Django and I am taking advantage of the models, migrations orm etc.
Each model has a column id
I was wondering if it is possible to rename this column to something else like person_id
I saw some examples creating new primary key columns but that is not what i want. I want to rename the existing id
column name
You've said its not what you want but the answer is to make your own primary key,
From the docs,
If you’d like to specify a custom primary key, just specify primary_key=True on one of your fields. If Django sees you’ve explicitly set Field.primary_key, it won’t add the automatic id column.
Since it doesn't add the automatic id column, you've effectively renamed it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With