ticket 34151 investigation and help needed for next steps

Hello everyone! New contributor here. My question/situation is a bit long so stick with me here.

I was investigating the following ticket, Adding an explicit primary key with a different type doesn’t update related ManyToManyFields

I was trying to run the setup described in this ticket, and I discovered some interesting things and have 3 questions:

1, Trying to run the setup shows that the migration script autogenerated by Django actually does not work. I had to use a workaround described here to manually correct the migration script generated. Should I create a ticket for this issue? Solve: django.db.utils.OperationalError: near ")": syntax error · GitHub

2, After fixing the autogenerated Django script, there seems to be a foreign key issue that is reported in a ticket here. I got around this issue by deleting the foreign relationship, for me, it was app_storechain_place. Is there another way around this?

ticket: 29574 (the forum does not allow new users to post more than 2 links)

3, After going through everything and finally running the migration, the primary key of both models’ data types was updated correctly (see img). I am wondering if this means this issue is no longer an issue. On the ticket, it mentioned how the update only changes the model table and does not change the relationship table. I have no idea what the difference between the two is. I kind of assumed it was just a translation error. Does anyone know what they are talking about? Or maybe the issue is already solved?

Sorry for the long post!

What you’re looking to verify here is the “join table” that connects these two models. It’s probably either going to be app_place_storechain or app_storechain_place if the model definitions don’t specify the through table.

That is the schema definition that you want to examine.

1 Like

Thanks! That makes a lot of sense!

I think I know what is the problem now and why it is related to ticket 29574.

The migration auto-generated by Django does not even run because of app_storechain_place as mentioned in the ticket above.

This makes the problem mentioned in #29574 (Unable to create model instance after changing an abstract model to non-abstract due to "foreign key mismatch" error) – Django to be a prerequisite to solve before tackling 34151.